I am still learning ... so don't mind me stating the obvious:

int* a[3];      // defines an array a
                   // (of integer pointers of the size 3)
 
int* (*x) [3]; // defines a pointer x of the size 3 
                   // (to an array of integer pointers)
 
int* (*y) [4]; // defines a pointer y of the size 4
                   // (to an array of integer pointers)
 
int** b[3];    // defines an array b of the size 3
                   // (of pointers to integer pointers)

so what you can do is this:

x = &a; // sets x to the address of a

while this does not work:

y = &a; // does not work as &a is a 
           // pointer to an array of the size 3 of integer pointers,
           // while y is a pointer to an array of the size 4 of
           // integer pointers

yet you could also do this:

int** z = a; // sets the pointer to an integer pointer z to a,
                 // which is an array of integer pointers and as such
                 // IS the pointer to its first element

So what C++ does is not making a pointer to the pointer of the first element of the array a which would be a pointer to a pointer to an integer pointer, but it makes a pointer to an integer pointer array of the size 3.

Sounds kind of complicated? Well, the lot of us has an headache now.

VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)