Machine-translated by Google. Questions are authored in English.
Top

Discussion

What does the strcmp() function return when the two strings compared are identical ?

  • A.-1
  • B.0
  • C.1
  • D.The length of the string

Answer: B

Correct answer: 0

strcmp() returns zero for identical strings, a negative value when the first sorts before the second and a positive value otherwise. The common mistake is to treat a zero return as false and so invert the test.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.