0
int arr[3] = {1,2,3};
printf("%d", **(&arr));   // Answer = 1

Why &arr needs double dereferencing(**&arr) to find the value of the element of array. Can someone help me picturize/imagine the memory layout that is happening in background?

I understand double referencing as below: memory layout of pointer to a pointer

int x = 10;
int *ptr_1 = &x;
int **ptr_2 = &ptr_1;
print("%d",**ptr_2);       // Answer = 10

0 Answers0