个人微薄: weibo.com/manuscola
分类: C/C++
2010-10-19 23:16:07
zhangbo18822012-10-24 21:34:50
int x = 1;
printf( "%s" , *(char *)&x == 1 ? "little" : "big");
GFree_Wind2011-07-15 12:06:44
呵呵,如果是我,会这样写。
#include <stdio.h>
#include <stdlib.h>
int main()
{
union {
unsigned int i;
unsigned char c;
} un;
un.i = 1;
printf("%s endian!\n",
un.c ? "Smaall":"Big"