#include <stdio.h>
union
{
unsigned short num;
unsigned char c[2];
} data;
int main(int argc, char const *argv[])
data.num = 0x0102;
if (data.c[0] == 1)
printf("大端字节序\n");
}
else
printf("小端字节序\n");
return 0;