CJCoding With Joseph
← Back to Question List
C Code Walkthrough #43

Array Aliasing Through a Pointer

hardArrays

📄 Code

Read carefully — what does this print?
1#include <stdio.h>
2int main() {
3 int arr[4] = {10, 20, 30, 40};
4 int *p = arr;
5 p[1] = 99;
6 *(p + 2) += 5;
7 printf("%d %d %d %d", arr[0], arr[1], arr[2], arr[3]);
8 return 0;
9}

🎯 Your Answer