Activity 20.7.
Which strings come first in the alphabet?
strcmp
function. This function compares two strings and returns a negative number, zero or a positive number depending on which of the two strings comes first in the alphabet.strcmp
compares the two strings character by character. If the first character of two strings is equal, the next character of two strings are compared. This continues until the corresponding characters of the two strings are different or a null character ’\0’ is reached. Here is the return value of the function:strcmp()
returnsstrcmp()
return? Use the code window below to look at a bunch of examples and really understand the function.