As far as I know, in some contexts the array is converted to a pointer to its first element:
int a[5];
int * p;
p = a;
Following this approach and considering that I can assign an array to a pointer, why can't I assign a two-dimensional array to a pointer to a pointer?
int a[5][5];
int ** q;
q = a;
However, I can assign an array of pointers to a pointer to a pointer:
int * p[5];
int ** q;
q = p;
If the array is converted to a pointer to its first element, when q = a occurs in the second example, a must be a pointer to [0], and [0] must be a pointer to [0] [0], right?
Also, I am not getting the error message:
cout << **a;
Thanks in advance, and I hope you can help me understand.
source
share