1. 程式人生 > >C語言一個語句判斷大小端

C語言一個語句判斷大小端

urn ref div .org oid iter end doc 語句

1 int isLittleEndian(void)
2 {
3     return *(char *)(int []){1} == 1;
4 }

關於Compound Literals,https://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Compound-Literals.html

C語言一個語句判斷大小端