Originally Posted by
dariyoosh
That is very sad.
"That" also happens to be correct. The address of an array is not a pointer to pointer.
Originally Posted by
dariyoosh
An address is the content/value of a pointer. Saying an address is/is not equivalent with a pointer has no meaning.
The value of an uninitialised pointer is not an address. Even accessing the value of the pointer gives undefined behaviour. Trying to use that value as an address gives undefined behaviour.
Originally Posted by
dariyoosh
There are for sure double pointers. Each row is an array, therefore a pointer to the address of its first element. And each element is also an array therefore again a pointer to the address of each first element (which is not an array).
Conclusion: 2D array = a pointer to a pointer
You are starting with the incorrect assumption that a 1D array is a pointer. It is not. A 2D array is an array of 1D arrays. It is not a pointer to a pointer.
By your (flawed) logic, you would expect this code to compile.
Code:
int main()
{
int x[3][3];
int **p = x;
p = x;
}
However, all standard-conformant compilers will reject the second and third lines of main().