大小端

小端 大值占大位
大端 大值占小位
遇到的困惑 bool

怎么没有在C里面定义呢????? 求解释

#大小端判断程序
#include <stdio.h>
typedef enum
{
    false,
    true
}bool;
typedef union
{
    unsigned short int value;
    unsigned char byte[2];
}to;
bool is_smallending(to arg)
{
   if( arg.byte[1] == 0xab)
   {
       printf("Hi,this is smallending\n");
       return true;
   }
   printf("Hi,this is bigending\n");
   return false;
}
int main()
{
    to hello;
    hello.value = 0xabcd;
    is_smallending(hello);
}
posted on 2017-12-02 10:47  HDU李少帅  阅读(1124)  评论(0编辑  收藏  举报