Dereference operator is used to access or manipulate data contained in memory location pointed to by a pointer. but in the below code when we use the dereference operator we get address instead of data contained in memory location .
Looks like a is an int*** (or is a 3D array).
So...
*a is an int** (value is an address)
**a is an int* (value is an address)
***a is a int (value is an int)
If you have int arr[10], then you need to dereference once to get an int.
If you have int arr[10][9][8], then you need to dereference all three layers to get an int.
int arr[10] is an array.
int arr[10][10] is an array of arrays.
int arr[10][10][10] is an array of arrays of arrays.
etc.
With the below code, we can access value of 2-D array with one layer dereference.
I expect for access value of 2-D we should need two dereference **ptr instead *ptr
For MS VS 2019, if you compile as C++ you get the error C2440 cannot convert from 'int [3][3]' to 'int *'. But if you compile as C, you get the warning C4047 'int *' differs in levels of indirection from 'int (*)[3]' - but the compilation succeeds!
True, I just assume a thread is C++ unless the OP specifically says it's C.
I guess C is more permissive here, but my guess is it's in the realm of "don't do that"/undefined behavior.
Edit: In this particular case, I assume assigning the array to an int* will now treat that int* as if it's pointing to a contiguous array of length 9, but I'm making a lot of assumptions in this post.