C program is given below: # include <stdio.h> int main () { int i, j; char a…

GATE · 2008 · IT

C program is given below:

# include <stdio.h>
int main ()
{
        int i, j;
        char a [2] [3] = {{'a', 'b', 'c'}, {'d', 'e', 'f'}};
        char b [3] [2];
        char *p = *b;
        for (i = 0; i < 2; i++) {
              for (j = 0; j < 3; j++) {
              *(p + 2*j + i) = a [i] [j];
              }
        }
}

What should be the contents of the array b at the end of the program?

  1. A.

    a b

    c d

    e f

  2. B.

    a d

    b e

    c f

  3. C.

    a c

    e b

    d f

  4. D.

    a e

    d c

    b f

Attempted by 70 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…