CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Flattening a 2D Array Through a Pointer

C code walkthrough · Question 50
hardPointers

Code

Read carefully. What does this print?
1#include <stdio.h>
2 
3int main() {
4 int m[2][3] = {{1, 2, 3}, {4, 5, 6}};
5 int *p = &m[0][0];
6 printf("%d %d\n", p[3], p[5]);
7 return 0;
8}

Your answer