K
Kobu
I've read the FAQ and several posts on multidimensional arrays and how
their names decay to pointer to arrays (not pointer to pointers).
If this is so, why does the following code fragment compiler and run
correctly?:
#include <stdio.h>
int main()
{
int example[4][4]={ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16};
printf("\nBEFORE DOUBLE DEREFERENCING of example:\n");
printf("\nexample[0][0] = %d\n",example[0][0]);
**example = 100; /* double dereferencing 'example' */
printf("\nAFTERDOUBLE DEREFERENCING of example:\n\n\n");
printf("\nexample[0][0] = %d\n",example[0][0]);
return 0;
}
The code ('example') behaves just like a pointer to a pointer. Then
why isn't it a pointer to a pointer?
their names decay to pointer to arrays (not pointer to pointers).
If this is so, why does the following code fragment compiler and run
correctly?:
#include <stdio.h>
int main()
{
int example[4][4]={ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16};
printf("\nBEFORE DOUBLE DEREFERENCING of example:\n");
printf("\nexample[0][0] = %d\n",example[0][0]);
**example = 100; /* double dereferencing 'example' */
printf("\nAFTERDOUBLE DEREFERENCING of example:\n\n\n");
printf("\nexample[0][0] = %d\n",example[0][0]);
return 0;
}
The code ('example') behaves just like a pointer to a pointer. Then
why isn't it a pointer to a pointer?