/* endian $Id: endian.c,v 1.1 2006-11-16 18:47:27+09 kaiya Exp kaiya $ */ #include main(){ int x=1; // 0x00000001 if (*(char*)&x) { /* little endian. memory image 01 00 00 00 */ puts("little"); }else{ /* big endian. memory image 00 00 00 01 */ puts("big"); } }