int func(int a[]);
int main()
{
int c = 21;
int *b;
b=&c;
printf("%d",b);
func(b);
return 0;
}
int func(int a[]){
printf("\n%d",(a));
printf("\n%d",*(a));
printf("\n%d",(a[0]));
printf("\n%d",(a[1]));
printf("\n%d",(a[2]));
}
this is something I'm trying to understand how these pointers work with arrays. this is the output.
-680548828
-680548828
21
21
-680548828
32767
the first two 680548828 and the two 21s I understand. simply printing a would be the first element of array a[]. a[0] is like writing *a. what I dont get is why a[1] would have 680548828 in it. a[1] is the element in the array after the element where the pointer to 21 is stored(a[0])? sorry for the confusion please help. Thank you.