1.7Endianness
The idea
Endianness is the order in which the bytes of a multi-byte number are stored in memory.
Think of it like this: Writing a date as DD/MM/YYYY or YYYY/MM/DD. Same information, different order.
Why it exists
Memory is a row of single bytes, but numbers are several bytes wide, so a convention is needed. Mixing conventions garbles data between machines.
How it works
- Big-endian: most significant byte at the lowest address.
- Little-endian: least significant byte at the lowest address (x86).
- The number is the same; only the layout in memory differs.
Worked example: 0x12345678 stored at address 1000
Big-endian: 1000 → 12, 1001 → 34, 1002 → 56, 1003 → 78. Little-endian: 1000 → 78, 1001 → 56, 1002 → 34, 1003 → 12.
Now play with it
- →Type another hex value and see both layouts. The gold byte is the most significant one.
Highlighted byte is the most significant byte (0x12).
Check yourself
Little-endian, 0x12345678 stored at address 1000. Which byte is at address 1000?
Exam notes (the dense version)
Big-endian: MSB at lowest address. Little-endian: LSB at lowest address (x86).
Previous year questions: Instruction Formats & Addressing Modes (12)
PYQs are grouped by topic, so this is the full set for Instruction Formats & Addressing Modes; try the ones that match this subtopic. Open all 12 on the topic page.