Consider a union that stores 0xAABBCCDD as an unsigned value and exposes the same storage as an array of unsigned char. Printing the bytes may produce 0xDD, 0xCC, 0xBB, 0xAA—or the reverse order—depending on the platform. section 12.2
This is implementation-defined behavior: the C standard permits alternatives, and the implementation chooses one. The in-memory order of representation digits for an arithmetic type is implementation defined. Low-order digits first is little-endian; high-order digits first is big-endian. section 12.2
Other platform choices appear in basic types:
- The precision of C’s unpromoted integer types is constrained but not prescribed, so it depends on implementation-defined factors. section 5.2
- The type char may be signed or unsigned depending on the platform. section 5.2
- Assuming eight-bit unsigned char values and hexadecimal byte formatting also relies on implementation-defined properties: CHAR_BIT equal to 8 and UCHAR_MAX equal to 255. section 12.2
Inspecting integer representation
A union containing unsigned val and unsigned char bytes[sizeof(unsigned)] can print the stored value and each byte. On a little-endian implementation, 0xAABBCCDD appears as DD, CC, BB, AA. The result is useful for observing the implementation, not for assuming a portable byte order.

