Endianness refers to the byte order used to represent multi-byte data types (like integers or floating-point numbers) in memory. In little-endian systems, the least significant byte is stored first, while in big-endian systems, the most significant byte is stored first. For instance:
- Little-endian (x86 architecture):
0x01020304
→ in memory as[0x04, 0x03, 0x02, 0x01]
- Big-endian (network byte order):
0x01020304
→ in memory as[0x01, 0x02, 0x03, 0x04]
Endianness can affect network programming, binary file formats, or when interfacing with hardware, making it important to detect the system's endianness in certain situations.