What does the following fragment of C program print? char c[] = "GATE2011";…

PYQ GATE 2011Modified — slightly modified from the official paper; see the solution

What does the following fragment of C program print?

char c[] = "GATE2011";
char *p = c;
printf("%s", p + p[3] - p[1]);

  1. A.

    GATE2011

  2. B.

    E2011

  3. C.

    2011

  4. D.

    011

Attempted by 352 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…