Answer: A
Big Endian: Table of address and data in hex
int i
1000 |
1004 |
1008 |
1012 |
00 |
00 |
00 |
FF |
s points to address 1000. Since s is a short pointer it will read data from 1000 – 1007 which is all zeroes: 0
Little Endian: Table of address and data in hex
int i
1000 |
1004 |
1008 |
1012 |
FF |
00 |
00 |
00 |
In this scenario also s points to the address 1000. In little endian bytes are stored in reverse but those are also read in reverse.
s reads the data from 1000 – 1007 which is oxFF 00. It is first reversed 0x00 FF and then interpreted.: 255