Which of the following is correct, If we write strcmp(s1,32), returns a value? a) <0 when s1b) = 0 when s1 =s2 c) > 0 when s1 > s2 d) all of these
Answers
Answered by
1
ANSWER: OPTION B
Given: strcmp (s1 ,32)
Let us take s1 as string 1 and 32 as string 2.
The ASCII value of first character each string should be compared.
ASCII value of s: 19
ASCII value of 3: 51.
Hence, the string 2 ASCII value is higher than the first character of string 1 ASCII value. strcmp returns the value less than zero since s1 < s2.
Similar questions
Science,
6 months ago
Science,
6 months ago
Chemistry,
6 months ago
Business Studies,
1 year ago
Science,
1 year ago