union中的所有成员起始地址都一样共用一存储空间,union占用内存大小=成员占用内存最大值
利用union可以测试系统的大小端
int checkSystem( )
{
union check
{
int i;
char ch;
} c;
c.i = 1;
return (c.ch ==1);//如果返回1,小端。否则是大端
}