What will the following code output? char str1[] = "world"; char str2[] =…

Hexaware · 2024CoCubes · Computer Science · 2024

What will the following code output?

char str1[] = "world";

char str2[] = "hello";

if(strcmp(str1, str2) > 0)

printf("str1 is greater");

else

printf("str2 is greater");

  1. A.

    str1 is greater

  2. B.

    str2 is greater

  3. C.

    Equal strings

  4. D.

    Compilation error

Attempted by 182 students.

Sign up free to check your answer

Sign up free

Explore the full course: C Language

Loading lesson…