0

What is 'strcmp' in c++ ?

how it works? what is it for?

22nd Oct 2018, 12:23 PM
Iryna Misiuchenko
Iryna Misiuchenko - avatar
1 Answer
+ 2
This is function for comparing C-strings: int strcmp( const char *str1, const char *str2); The function gets 2 C strings as arguments, then it compares their corresponding symbols one by one. It performs a binary comparison of the characters. It will return 0, if both strings' content is equal. Less than 0, if first unmatched character has a lower value in str1 than in str2. Greater than 0, if first unmatched character has a grearer value in str1 than in str2.
22nd Oct 2018, 12:35 PM
microBIG
microBIG - avatar