What will be the output of the following C code? Assume that the required…

What will be the output of the following C code? Assume that the required headers are included and these statements are inside a valid function.

char str1[] = "Coding";
char str2[] = {'C', 'o', 'd', 'i', 'n', 'g', '\0'};

if (strcmp(str1, str2) == 0)
    printf("Same");
else
    printf("Not Same");
  1. A.

    Same

  2. B.

    Not Same

  3. C.

    Compilation error

  4. D.

    Runtime error

Attempted by 126 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…