Usually I feel like I understand the initialization from incompatible pointer type error, but I'm a bit confused here.
#include <stdio.h>
int main() {
int a[10];
int *p = a; // fine
int *q = &a; // incompatible, expected
int **z = &a; //incompatible, unexpected
return 0;
}
I assumed that the variable a is interpreted as an int*
pointer to the first element of a
, a[0]
. So I expected int* q = &a
to give me an incompatible warning, but I thought int** z = &a
would be correct...?
How is one supposed to actually do this?