c - strcmp isn't comparing strings properly -
this question has answer here:
so have (not full code)
char list[1000][10];
strcpy(list[0],"ab");
printf("%d\n",strcmp(list[0],"ab"));
and strcmp returning 0. can explain why it's doing so?
thanks in advance.
the strcmp
method return 0 if list[0]
contains "ab" in case.
it returns:
returns integral value indicating relationship between strings:
a 0 value indicates both strings equal.
a value greater 0 indicates first character not match has greater value in str1 in str2; , value less 0 indicates opposite.
Comments
Post a Comment