1 #include <stdio.h> 2 typedef unsigned char BYTE; 3 int main(int argc, char* argv[]) 4 { 5 unsigned int num,*p; 6 p = # 7 num = 0; 8 *(BYTE *)p = 0xff; 9 if(num == 0xff) 10 { 11 printf("little\n"); 12 } 13 else //num == 0xff000000 14 { 15 printf("big\n"); 16 } 17 return 0; 18 }
或者
1 int checkCPU() 2 { 4 union w 5 { 6 int a; 7 char b; 8 }c; 9 c.a = 1; 10 return (c.b == 1);12 }
时间: 2024-10-27 09:18:04