Consider this code:
int ar[3] = {1, 2, 3};
int *ar2 = ar;
This code compiles. I know that ar
decays into a pointer to an int and it makes sense that I can initialize ar2
with ar
.
I want to similarly initialize a two dimensional array but this code doesn't compile:
int ar3[3][2] = {{1, 2}, {3, 4}, {5, 6}};
int **ar4 = ar3;
Why?