I am new to C programming, and there is a question that bothers me. Let's see the following piece of code:
int main()
{
int arr[3]={1,2,3};
printf("%d\n", arr);
printf("%d", &arr);
}
If I run this code, it gives the same result for both arr and &arr. But why arr=&arr? I have seen quite a lot of answers on this topic, but none of them is clear to me. In a nutshell, people agree that an array variable holds the address of the first element of the array, e.g., arr holds the address of arr[0], say arr= 4340. Then the variable arr must be stored somewhere in the memory and &arr is the address of the memory cell that stores the value 4340. If &arr = arr then it turns out that 4340 is stored at address 4340. But the value at address 4340 is the value of the first element of the array, so it should be 1??? I am very confused at this point and would really appreciate some help.