Which one of the choices given below would be printed when the following…

PYQ GATE 2006

Which one of the choices given below would be printed when the following program is executed ?

 #include <stdio.h>
struct test {
               int i;
               char *c;
}st[] = {5, "become", 4, "better", 6, "jungle", 8, "ancestor", 7, "brother"};
main ()
{ 
    struct test *p = st;
    p += 1;
    ++p -> c;
    printf("%s,", p++ -> c);
    printf("%c,", *++p -> c);
    printf("%d,", p[0].i);
    printf("%s \\n", p -> c);
} 

  1. A.

    jungle, n, 8, ncestor

  2. B.

    etter, u, 6, ungle

  3. C.

    cetter, k, 6, jungle

  4. D.

    etter, u, 8, ncestor

Attempted by 199 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…