C Code to find endianness (little endian or big endian)
Memory map in case of Little Endian Architecture
Memory map in case of Big Endian Architecture
Pasted below is the output of the program compiled and executed on my netbook running on Intel atom processor.
Here you can see that first byte printed using the pointer p is 0x55 and second byte is 0xAA. Since lower byte lies in the lower address it is Little endian architecture.