I am implementing a lexicographic sort and my professor told us to use strcmp
in our implementation. The problem is, strcmp
is very confusing in respects to how it compares strings.
For instance, this here yields false:
if (strcmp("What", "am") > 0) {
printf("true\n");
} else {
printf("false\n");
}
Isn't "What" suppose to be greater than "am" lexicographically? The man page is very spartan in terms of explaining how the function determines if one string is greater or less than the other. There are some questions here, but I still cannot determine this result based on those explanations.