union { short val; char c[sizeof(short)]; } test; test.val = 0x0102; if (test.c[0] == 0x01 && test.c[1] == 0x02) cout << "big endian" << endl; else cout << "little endian" << endl;
0