I have a doubt about multi-dimensional arrays and pointers notation, as below.
int arr[2][4] = {{1,2,3,4}, {5,6,7,8}};
printf("%d\n", (arr+1));
printf("%d\n", *(arr+1));
Why in both printf()
calls, the result printed is the same? Both bring the addresses of the second array inside of the arr
.
The first one I understand because arr
is a memory address and so, adding 1 to it moves the pointer ahead by (the size of the inner array * size of integer).
But for the second one I am confused because if I put *
before (arr+1)
, shoudn't it be the value on the address of (arr+1)
?