LearnFrenzy
Sign in Take a free test

C Library Functions · Library Functions MCQ · Question 5

What does strcmp() return? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 5 Back to Exercise

What does strcmp(s1, s2) return when s1 comes before s2?

  • A -1 exactly
  • B A negative value (any negative int) Correct
  • C 0
  • D false
Correct Answer: Option B

The standard only promises the sign. Test strcmp(a, b) < 0, never == -1.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links