#1,083 – Using Visual Studio to Verify Little-Endianness

We know that Intel processors use a “little-endian” scheme when deciding how to store binary data in memory.  That is, bytes from the “little end” of a number will be stored earlier in memory than the bytes from the “big end”.

We can see this little-endianness in action by using Visual Studio to look at how a data item is stored in memory.

Let’s say that we have a 4-byte (32-bit) unsigned integer with a value of 0x1234ABCD, assigned to a variable named “myNumber”.  We can view the memory location where this number is stored by bringing up the Memory window in Visual Studio and then entering “&myNumber” in the Address area.

1083-001

1083-002

When you press RETURN, you’ll see the memory location where myNumber is stored.  Notice that the first byte is CD, followed by AB, etc.  The number is stored in a little-endian manner.

1083-003

 

Advertisements