By running this program on my computer, I'm getting same addresses. I'm for case of array
and &array[0]
I understand that name of array
points to the address of first item in the array
. And both of them are same.
But I'm unable to understand why name of array
and &array
points to the same address. What comes in my mind about this is that it will print the address of that pionter in which address of first item in array is stored.
Code
#include <stdio.h>
int main()
{
char arr[3];
printf("array = %p\n", arr);
printf("&array[0] = %p\n", &arr[0]);
printf("&array = %p\n", &arr);
return 0;
}
Output
array = 0061FF1D
&array[0] = 0061FF1D
&array = 0061FF1D