C code to check your system's endianness
/* if you don't know what is "Endianness", here is a wikipedia article about the topic: Endianness */
#include <stdio.h> int main(){ unsigned short s = 0x0001; unsigned char c; /*point to 's' using a char pointer, then dereference it, this will access the first byte of 's' and copy it to 'c'.*/ c = *(unsigned char *) &s;
if(c == 0x01){ printf("this is a little endian system.\n"); }else{ printf("this is a big endian system.\n"); } return 0; }














