大端:高位存在低地址,低位存在高地址;
小端:高位存在高地址,低位存在低地址;
判断大小端的函数
小端:高位存在高地址,低位存在低地址;
判断大小端的函数
int checkCPUendian()//返回1,为小端;反之,为大端;
{
union
{
unsigned int a;
unsigned char b;
}c;
c.a = 1;
return 1 == c.b;
}