Let's consider the following C code :
char matrix[10][10];
char** array;
array = matrix;
printf("%c", array[2][3]);
I have a warning on line array = matrix
: assignment from incompatible pointer type
I guess it's because the first array has been declared statically and the second one has been declared dynamically, but the real problem is on the printf
line. The program simply crashes.
I can't seem to access a char**
with [][]
operators.
How can I fix that ?
NOTE: I simplified the context a little bit. In the original program, array
is assigned through a function which return type is char**
but actually returns a char[10][10]
.