Different Pointer Arithmetic Results when Taking Address of Array
Solution 1:
x -> Points to the first element of the array.
&x ->Points to the entire array.
Stumbled upon a descriptive explanation here: http://arjunsreedharan.org/post/69303442896/the-difference-between-arr-and-arr-how-to-find
SO link: Why is arr and &arr the same?
Solution 2:
In case 4 you get 0x100 + sizeof x
and sizeof x
is 4 * sizeof int
= 4 * 4 = 16 = 0x10.
(On your system, sizeof int
is 4).