Knowee
Questions
Features
Study Tools

Which one of the following statements is correct?Select one:strcmp(s1, s2) returns 0 if s1==s2strcmp(s1, s2) returns 1 if s1==s2strcmp(s1, s2) returns a number greater than 0 if s1<s2strcmp(s1, s2) returns a number less than 0 if s1>s2

Question

Which one of the following statements is correct?Select one:strcmp(s1, s2) returns 0 if s1==s2strcmp(s1, s2) returns 1 if s1==s2strcmp(s1, s2) returns a number greater than 0 if s1<s2strcmp(s1, s2) returns a number less than 0 if s1>s2

🧐 Not the exact question you are looking for?Go ask a question

Solution

The correct statement is: "strcmp(s1, s2) returns 0 if s1==s2"

Explanation: The strcmp() function in C programming language compares two strings. If both strings are identical, it returns 0. If the ASCII value of the first unmatched character is greater in the first string, it returns a value less than 0. If the ASCII value of the first unmatched character is less in the first string, it returns a value greater than 0.

This problem has been solved

Similar Questions

Which of the following statements would produce a True result given this code?char s1[] = "alpha";char s2[] = "alpha";char s3[] = "beta";char s4[] = "gamma";Select one:a.strcmp(s1, s2);b.strcmp(s1, s3);c.strcmp(s3, s4);d.strcmp(s1, "Alpha");

If two strings are identical, then what will be the return value of strcmp() function?Select one:0-11

Which of the following is a valid comparison operator in SQL? &&<=** ==

Which of the given options has same output as given statement?If var1=7var2=5var3=1var4=10var5=20(var1*var2)>(var5+var4*var3) and ((var5+var3)/var1)>=(var2-2)/var3

Select the correct answerWhich of these statements is correct?Options true and false are numeric values 0 and 1true and false are numeric values 1 and 0true is any non zero value and false is 0true and false are non numeric values

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.