void m() {
char a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
char(*c)[3][3] = (char (*)[3][3])a;
printf("%d\n", *c[0][0]);
}
For instance, in this function the variable a
points to a location in memory with 9 integers in a row.
But what about c
? Does c
point to a location in memory which points to a location in memory that holds 9 integers in a row?
So, technically, is c
a single layer pointer or a double layer pointer?
Shouldn't what I said above be true? How come when I execute the below function:
void m() {
char a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
char(*c)[3][3] = (char (*)[3][3])a;
printf("%d\n", *c[0][0]);
printf("a...%p\nc...%p\n", a, c);
}
a and c both point to the same locations? Shouldn't c be a double layer pointer, and a be a pointer to a location in memory?