Multiple choice

What will the output of the strcmp() function if the strings to be compared are exactly the same?

  1. 0

  2. 1

  3. True

  4. False

  5. -1

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The strcmp function compares the contents of two strings and returns a value indicating whether they are same or not. It can return the following values : < 0 - If string1 is less than string2 > 0  - If  string2 is less than string1   0    -   If string1 is equal to string2 Strcmp considers the case of the string during comparison.