C语言——用联合体判断大小端

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Eleanor_12/article/details/53716181

用联合体判断大小端,大端返回0,小端返回1

  union w
 {
 int a;
 char b;
  } u;
int judge()
{
u test;
test.a = 1;
if(test.b == 1)
{
    return 1;
}
else
{
return 0;
}
}


猜你喜欢

转载自blog.csdn.net/Eleanor_12/article/details/53716181