The quoted text is from a book. I need to confirm this. Suppose the two strings are: "Hello there" (first string), "John Adams" (second string). According to the text, if the "first string" appears before the second string then a -ve number will be returned and first string is considered to be less. So, in case of our supposed strings if we write strcmp(first string, second string) a negative number will be returned. Correct? Thanks for your help.
Quote
The operator==() function uses the library function strcmp() to compare the two C-strings. This function returns 0 if the strings are equal, a negative number if the first is less than the second, and a positive number if the first is greater than the second. Here less than and greater than are used in their lexicographical sense to indicate whether the first string appears before or after the second in an alphabetized listing.


Sign In
Create Account


Back to top









