Determine Host Byte Order (Endianness)

Determine the host byte order (endianness) of a system.

Statement

Write a program to determine the host byte order (endianness) of any system.

The figure below shows the little-endian and big-endian representations of 0x01234567, where A0-A3 are the byte addresses in increasing order.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.