+ 3
What strcmp function do
discussion
2 Antworten
+ 2
strcmp is the C equivalent of std::string::operator==. It's a function that takes two constant C strings (char* to the first element of a '\0' terminated sequence of chars) and returns an int.
If it is 0, the strings are equal.
If it is <0, the letter with the mismatch has a lower ASCII value in the first string and vice versa.
+ 1
This function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ or until a terminating null-character is reached.
http://www.cplusplus.com/reference/cstring/strcmp/