ProgrammingHardGATE CS · Infosys

What is printed?

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

Correct answer: A. 6

m + 1 points at row 1, and adding 2 to its first element gives m[1][2], which is 6.

More C Programming questions

Exams that ask this topic