Vidyalelo
C Programming · Q59

Arrays and Strings

Programming · C Programming · question 59

Q59

What is the return value of the following statement if it is placed in C program? strcmp("ABC", "ABC");

A.
33
B.
-1
C.
1
D.
0
Answer
E.
Compilation Error

Answer: Option D

Solution

Answer: Option D
Solution:

strcmp(s1, s2);
returns int as follows:
== 0, when s1 == s2
< 0, when s1 < s2
> 0, when s1 > s2