I have a question about pointers and arrays in C++. I'm not sure exactly what this section of code is doing. As the way I see it iarray is declared as a normal array. However q is being accessed like its a 2d array.
int iarray[10];
int *p = iarray;
int **q = &p;
q[0][2] = 25;
And if I change the iarray to:
int iarray[10]{3,2};
int *p = iarray;
int **q = &p;
q[0][2] = 25;
cout << q[0][0] << endl;
cout << q[1][0] << endl;
The first one will print 3, which I understand as I declared it above. But the second one is blank and I don't understand why.
q[0][1], notq[1][0]q[1]causes undefined behavior.