Why can\'t we use double pointer to represent two dimensional arrays?
arr[2][5] = {\"hello\",\"hai\"};
**ptr = arr;
Here why doesn\'t the d
In C, a two-dimensional array is an array of arrays.
You need a pointer-to-array to refer to it, not a double-pointer:
char array[2][6] = {"hello", "hai"};
char (*p)[6] = array;
//char **x = array; // doesn't compile.
For a double pointer to refer to "2-dimensional data", it must refer to the first element of an array of pointers. But a 2-dimensional array in C (array of arrays) is not the same thing as an array of pointers, and if you just define a 2-D array, then no corresponding array of pointers exists.
The only similarity between the two is the [][] syntax used to access the data: the data itself is structured quite differently.