int *p = ( int[] ){ 1, 2, 3, 4 };
Doing this I am able to initialize a anonymous array
to a pointer p
.
In a similar way I want to assign arrays of array (i.e. probably 2D array) in
array of pointers. And so I have tried the following code:
int *p[]= (int [][3]) { {1,2,3},{10,20,30} };
But it goes wrong, anyway if I assign it to a pointer to whole Array( as int (*p)[]= (int [][3]) { {1,2,3},{10,20,30} };
) it works fine.
I am in confused that if a pointer can get assigned a anonymous array why the array of pointers could not get assigned to 2d array?