Suppose mat
is a pointer to an array of size 5
where each element is an integer
int (*mat)[5];
and I have initialized it as
int a[5] = {5, 4, 3, 2, 1};
mat = &a;
I've written the code as
#include <stdio.h>
int main()
{
int (*mat)[5];
int a[5] = {5, 4, 3, 2, 1};
mat = &a;
printf("%p\n%p\n%d\n", mat, *mat, **mat);
return 0;
}
Output:
43800
43800
5
Why does mat
and *mat
give the same answer?