previous | start | next

Endian Examples

int x = 0x12345678;

Suppose the address of x is determined to be 0x0400. Then the 4 bytes
of integer x are stored at addresses 0x0400 to 0x403. 



int x = 0x12345678;

      Address      Byte Contents
      0x0400      0x12
      0x0401      0x34
      0x0402      0x56
      0x0403      0x78

If we print the 4 bytes of x starting at the address of x, we get:

      12 34 56 78

(spaces inserted just to see each byte value)



int x = 0x12345678;

      Address      Byte Contents
      0x0400      0x78
      0x0401      0x56
      0x0402      0x34
      0x0403      0x12

If we print the 4 bytes of x starting at the address of x, we get:

      78 56 34 12

(spaces inserted just to see each byte value)



previous | start | next