I am having troubles with the following code:
int a[] = {1, 2, 3, 4};
fprintf(stdout,
"a : %lu\n"
"*a : %d\n"
"&a : %ld\n"
"**(&a) : %d\n",
(unsigned long int)a,
*a,
(unsigned long int)&a,
**(&a)
);
Output:
a : 140726063647232
*a : 1
&a : 140726063647232
**(&a) : 1
i know that &a is a pointer to the 1 D array. And &a's type is int (*)[4].
I am confused with how comes **(&a): 1.
&ais a pointer to an array.*pgets what the pointer points to, so*&agets the array,a.An array treated as a pointer degenerates into a pointer to its first element, so
*ais1.Since
*&ais justa,**&ais the same as*a, which is1.