I am trying to parse the FAT filesystem & I notice that many of the fields are more than 2 bytes. I was reading someone's program and he has defined unsigned short for a given field of 2 bytes. Now, my question is how does the compiler handle endianness? If I convert the short into hex by using 02x, the data is handled properly. The file is opened in binary mode & I wonder how data more than a byte can be interpreted i.e. how does the compiler know which byte is the LSB/MSB? The same goes for long and int.