版权声明: https://blog.csdn.net/dashoumeixi/article/details/84774782
小端: 左->右
大端: 右->左
union{
short n;
char c[sizeof(short)];
}un;
un.n = 0x0102;
if(un.c[0] == 1 && un.c[1] == 2)
puts("big");
else if(un.c[0] = 2 && un.c[1] == 1)
puts("little");
else
puts("unknow");