CJCoding With Joseph
15free / daySign inCreate account
← Back to Question List
C Code Walkthrough #50

Flattening a 2D Array Through a Pointer

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

← Previous