C Programming - Strings - Discussion

Discussion Forum : Strings - General Questions (Q.No. 2)
2.
If the two strings are identical, then strcmp() function returns
-1
1
0
Yes
Answer: Option
Explanation:

Declaration: strcmp(const char *s1, const char*s2);

The strcmp return an int value that is

if s1 < s2 returns a value < 0

if s1 == s2 returns 0

if s1 > s2 returns a value > 0

Discussion:
14 comments Page 2 of 2.

Ankit said:   1 decade ago
What Sundar said is correct.

Yag said:   1 decade ago
I think it will return 1.

Jaimin kathrotiya said:   9 years ago
Yes, It returns zero.

Vinod said:   1 decade ago
Thanks


Post your comments here:

Your comments will be displayed after verification.