Strings

Q.

Which of the following statement is correct?

A. strcmp(s1, s2) returns a number less than 0 if s1>s2
B. strcmp(s1, s2) returns a number greater than 0 if s1
C. strcmp(s1, s2) returns 0 if s1==s2
D. strcmp(s1, s2) returns 1 if s1==s2

Answer : Option C

Explanation :

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

From the above statements, that the third statement is only correct.