ProgrammingHardGATE CS · TCS NQT

What is printed?

What is printed?
#include <stdio.h>
int main(void) {
    int m[2][3] = {{1, 2, 3}, {4, 5, 6}};
    int (*p)[3] = m;
    p++;
    printf("%d", **p);
}
  1. A. 4
  2. B. 1
  3. C. 2
  4. D. 5

Correct answer: A. 4

p++ moves the row pointer to m[1], and **p is the first element of that row, which is 4.

More C Programming questions

Exams that ask this topic