What's a double pointer??? **

closed account (17poGNh0)
I have seen such like int** myArray; why does it use a double pointer? what is the reason?
It is likely used as a pointer to the first element of an array of pointers, each itself a pointer to the first element of an array of integers. It's a fairly common C (not C++) implementation of dynamic "2D arrays".
The other option is that it is a reference to a pointer, meaning that the source pointer itself could be modified (such as reallocating the array and the like). In C++, you would say int*& myArray, but in C you have to say int** myArray.
Topic archived. No new replies allowed.