Endianness refers to the byte order in which multi-byte integers are stored in computer memory. Little-Endian architectures (x86_64, ARM) store the least significant byte at the lowest memory address, whereas Big-Endian architectures store the most significant byte first.
Checking CPU Endianness in C
#include <stdio.h>
int main(void) {
unsigned int val = 0x01;
char *c = (char *)&val;
if (*c == 0x01) {
printf("Architecture: Little-Endian (x86 / ARM)\n");
} else {
printf("Architecture: Big-Endian (Network Byte Order)\n");
}
return 0;
}
Comments and corrections