[2013.11.13][cpp]检测机器大端或者小端

今天在csdn上看到的 自己改进了一下发出来

小端输出1 大端输出0

union
{
  int i;
  char c[4];
} test;
test.i = 1;
cout << int(test.c[0]) << endl;

posted @ 2014-05-16 18:53  绝不原创的飞龙  阅读(10)  评论(0编辑  收藏  举报  来源