Strcmp () Returns the value in C

See the answer in English> How does strcmp() work? 9
I am learning strcmp() in C. I understand that when the two strings are equal, strcmp returns 0

However, when the man page states that strcmp returns less than 0 when the first string is smaller than the second string, does it refer to length, ASCII value or something else?

In this sense, the “less than” of the string means the dictionary (letter) order.

So cats are smaller than dogs, because cats are arranged in alphabetical order before dogs.

In a sense, the lexicographic order is all ASCII (and UNICODE) characters The expansion of the alphabetical order.

See the answer in English> How does strcmp() work? 9 9
I am learning strcmp() in C. I understand when When the two strings are equal, strcmp returns 0.

However, when the man page states that strcmp returns less than 0 when the first string is smaller than the second string, it refers to the length , ASCII value or something else?

In this sense, the “less than” of the string means the dictionary (letter) order.

So cat Smaller than dogs, because cats are arranged in alphabetical order before dogs.

In a sense, lexicographical order is an extension of the alphabetical order of all ASCII (and UNICODE) characters.

p>

Leave a Comment

Your email address will not be published.