C Programming - Strings - Discussion
Discussion Forum : Strings - General Questions (Q.No. 2)
2.
If the two strings are identical, then strcmp() function returns
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.
Deepu said:
1 decade ago
String compares compare two string if they are same it will return 1 else return 0. Any one give more explanation.
Sundar said:
1 decade ago
Returns an integral value indicating the relationship between the strings:
A zero value indicates that both strings are equal.
A value greater than zero indicates that the first character that does not match has a greater value in str1 than in str2; And a value less than zero indicates the opposite.
A zero value indicates that both strings are equal.
A value greater than zero indicates that the first character that does not match has a greater value in str1 than in str2; And a value less than zero indicates the opposite.
Yag said:
1 decade ago
I think it will return 1.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers