strcmp returns always "1" if str1>str2 ?Code:strcmp(str1,str2);
strcmp returns always "1" if str1>str2 ?Code:strcmp(str1,str2);
From the manual...
Code:RETURN VALUE The strcmp() and strncmp() functions return an integer less than, equal to, or greater than zero if s1 (or the first n bytes thereof) is found, respectively, to be less than, to match, or be greater than s2.
This will return 1 because "foo" is not equal to "bar".Code:strcmp("foo", "bar");
This will return 0 because "foo" is equal to "foo". If two strings are not equal, the function may also return -1.Code:strcmp("foo", "foo");
Last edited by Babkockdood; 06-19-2010 at 05:23 PM.