+ 1
Difference between strcmp() and strncmp().
Please explain in detail
5 Respostas
+ 8
With strncmp, you can specify the number of chars up to which you want to compare two strings.
+ 7
Coding Wala You have everything explained in the tutorial.
Please, read the COMMENTS in the lessons you can find a great examples and explanations.
strcmp(str1, str2)
- returns 0 when str1 is equal to str2;
- less than 0 when str1 < str2; and
- greater than 0 when str1 > str2.
strncmp(str1, str2, n)
- returns 0 when the first 'n' characters of str1 is equal to the first 'n' characters of str2;
- less than 0 when str1 < str2; and
- greater than 0 when str1 > str2.
• https://www.sololearn.com/learn/C/2937/
• https://code.sololearn.com/cy0uzj5ehg0S/?ref=app
+ 3
I can't be anymore detailed than these reference:
In brief, the `strncmp` allows to set a limit of how many characters to be compared.
http://www.cplusplus.com/reference/cstring/strcmp/
http://www.cplusplus.com/reference/cstring/strncmp/
+ 1
I also want to know the same
+ 1
Thanks to everybody for providing the clarification