strcmp() return values in C [duplicate]
问题 This question already has answers here : How does strcmp() work? (9 answers) Closed 2 years ago . I am learning about strcmp() in C. I understand that when two strings are equal, strcmp returns 0. However, when the man pages state that strcmp returns less than 0 when the first string is less than the second string, is it referring to length, ASCII values, or something else? 回答1: In this sense, "less than" for strings means lexicographic (alphabetical) order. So cat is less than dog because