http://bbs.chinaunix.net/thread-1257205-1-1.html
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { unsigned short v = 0x0102; unsigned char *p = (unsigned char *)&v; if (*p == 0x01) printf("big "); else if (*p == 0x02) printf("small "); return 0; } |