1 #include <stdio.h>
2
3 int main()
4 {
5 union
6 {
7 short s;
8 char c[sizeof(short)];
9 }un;
10 un.s=0x0102;
11
12 if(un.c[0]==0x01)
13 printf("big edian!\n");
14 else if(un.c[1]==0x02)
15 printf("small edian!\n");
16 return 0;
17 }
posted on 2010-08-23 10:13
何克勤 阅读(238)
评论(0) 编辑 收藏 所属分类:
C/C++ 、
Algorithm and Data Structure