int v = 0x0D0C0B0A; char* c = (char*)&v; if (*c == 0x0A) cout << "little endian"; else cout << "big endian";