+ 3

What strcmp function do

discussion

20th Apr 2018, 3:28 PM
anjali shah
anjali shah - avatar
2 Respostas
+ 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.
20th Apr 2018, 4:00 PM
Timon Paßlick
+ 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/
20th Apr 2018, 3:59 PM
Ali Zhussupov
Ali Zhussupov - avatar