05-03-2010 05:06 AM
These days I come across a strange problem wherein strcmp doesn't work at certain parts of my C program. I explicitly need to compare each character of the string in the array using == with the individual alphabet. e.g. actn=='R'
Has any of you come across this issue before?
string.h has been included as one of the header files.
OS: HP-UX B.11.00
Any input is appreciated
05-03-2010 02:45 PM
You first. Actual code might reveal more
than a vague (and confusing) description.
> [...] e.g. actn=='R'
What does that have to do with strcmp()?
> [...] strcmp doesn't work [...]
Much more likely: Your code is bad.
05-04-2010 01:23 AM
Maybe due to a memory corruption.
changing the code move can change the corruption footprint.
Or ending 0 is missing.
or there is a 0 at the middle of the string - which would mean it stops the comp at the first 0 encountered.