Skip to main content

Practice ยท 1 of 3

Runtime Endianness Verdict

CHALLENGE
Difficulty: advanced+25 XP

ISO C. Implement int byte_order(void) โ€” place 1 in an unsigned int, inspect its first byte, return 1 for little-endian, 0 for big-endian. (Other orders are vanishingly rare; the probe may legitimately report either of the two it can distinguish.) Implement const char *order_name(void) returning the fixed string 'little' or 'big' via byte_order().

Back to lesson: Practice: Portability Probes