I am trying to understand the logic between the three writing: array
, &array
and &array[0]
:
#include <stdio.h>
void foo(int *a);
void bar(int (*a)[3]);
void baz(int a[3]);
int main(void) {
int array[] = {1,2,3};
int* a = array;
int (*b)[sizeof(array)/sizeof(array[0])] = &array;
int* c = &array[0];
printf("%p, %p, %p", a, b, c);
}
I always thought int a[]
is a kind-of int *
. And in fact it works:
int *p = array;
But the address of a pointer to an int
is int**
:
int *u;
int **v = &u;
However here, the adresse of array
is not int**
but int (*)[3]
. I am lost.
What does the standard says about &array
?