Any variable will be identified by a single address, regardless of the size of the type.
If int i
is stored at address 0x1f00
, it takes up the four bytes 0x1f00
, 0x1f01
, 0x1f02
and 0x1f03
of space. Still, when you create a reference to it, you will get the start address only, because the size is implied by the type.
So when you create a reference to an int
and cast it to a char
reference, you don't change the address, you simply tell the compiler to treat it as a char
instead. I.e. the address is still 0x1f00
, and when you dereference it you will read whatever is stored there, which is like you say MSB for little endian and LSB for big endian machines.