I am a total beginner to C so please, work with my ignorance. Why does a normal pointer
int* ptr = &a; has two spaces in memory (one for the pointer variable and one for the value it points to) and an array pointer int a[] = {5}; only has one memory space (if I print out
printf("\n%p\n", a) I get the same address as if I printed out: printf("\n%p\n", &a).
The question is, shouldn't there be a memory space for the pointer variable a and one for its value which points to the first array element? It does it with the regular pointer int* ptr = &a;
ais defined elsewhere. But important to remember is that a C pointer contains no indication as to the size of the array it addresses, if it even addresses an array.ais declared as an array, thenais notationally same as&a.arris an array, typingarrgives you a pointer to the first element. If you take the address ofarryou also get a pointer to the first element.