Little endian architecture, Address 0000 stores 0xde
0001 stores 0xad
0002 stores 0xbe
0003 stores 0xef
Treat the data stored as 2 16 bit integers, what are the two values stored?
I thought the answer would be 0xadde and 0xefbe but I was wrong. Why?
Let's program it and see what happens:
#include &lt;stdio.h&gt;

int main(int argc, char *argv[]) {
  unsigned char mem[4] = { 0xde, 0xad, 0xbe, 0xef };

  printf(&quot;%02hhx %02hhx %02hhx %02hhx\n&quot;, mem[0], mem[1], mem[2], mem[3]);
  printf(&quot;%04hx %04hx\n&quot;, *(unsigned short *)(mem), *(unsigned short *)(mem + 2));
}

Here is the output:
de ad be ef
adde efbe