// LIttle Endian返回1
int check()
{
union w
{
int a;
char b;
}c;
c.a = 1;
return (c.b ==1);
}
或者:
short x = 0x1122;
char x0 = ((char *)&x)[0];
if (x0 = 0x22)
cout << "Little Endian" << endl;
// LIttle Endian返回1
int check()
{
union w
{
int a;
char b;
}c;
c.a = 1;
return (c.b ==1);
}
或者:
short x = 0x1122;
char x0 = ((char *)&x)[0];
if (x0 = 0x22)
cout << "Little Endian" << endl;