I used to feel confused about these code
int a[3] = {1,2,3};
int b[2][3] = {...};
int (*p1)[3] = &a; //pointer to array[3]
int (*p2)[3] = b; //same as above
int (*p3)[2][3] = &b; // pointer to array[2][3]
then I read some posts1 and understand the 'mystery' of array name including some explicit and implicit conversion.
So now I know p1 is a pointer to an array of 3 element with type int.
But how to understand that *(int (*)[3])
gets type int *
or
*(int (*)[2][3]
gets type int (*)[3]
?
Is it something that I should learn by rote?
posts I've read:
Difference between `a` and `&a` in C++ where `a` is an array
Array to pointer decay and passing multidimensional arrays to functions
PS: I don't know if it's a stupid question. But after reading the posts I mentioned above. I still feel kinda weird about that dereference operation stuff. Maybe it's just how the languge syntax work which I should simply bear in mind and stop digging. :D