why strcmp(name,"name")==0 gives true in C when both the strings are same? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

why strcmp(name,"name")==0 gives true in C when both the strings are same?

Strings in C

13th Jun 2020, 2:59 AM
Lind L Tyler
Lind L Tyler - avatar
2 Respuestas
+ 5
That's exactly how strcmp() works. It returns 0 if the strings are the same, else returns non-zero value. https://www.tutorialspoint.com/c_standard_library/c_function_strcmp.htm
13th Jun 2020, 3:04 AM
你知道規則,我也是
你知道規則,我也是 - avatar
0
Thank you Carrie I thought it was just like boolean values . Well Thank you very much.
13th Jun 2020, 3:06 AM
Lind L Tyler
Lind L Tyler - avatar