Mega Code Archive
Categories
/
C
/
Development
Show byte order, example
#include
#include
int main(void) { u_int32_t x = 0x12345678; /* 305419896 */ unsigned char *xp = (char *)&x; printf("Endian: "); printf("%0x %0x %0x %0x\n", xp[0], xp[1], xp[2], xp[3]); return 0; }