每日一題(51)—— 大小端判斷

請寫一個C函數,若處理器是Big_endian的,則返回0;如果Little_endian的,則返回1。 面試 int checkCPU() {  {   union w   {    int a;    char b;   } c;   c.a = 1;   return (c.b == 1);  } }分析: 嵌入式系統開發者應該對Little-endian和Big-endian模式很是瞭解
相關文章
相關標籤/搜索