How to find the endianness∞ of a system?
Finding the byte order(byte-endianness):
Courtesy: Alessandro's∞ post∞
in C community.
int nNumber = 1;
char cArray[ sizeof(int) ];
memcpy(cArray, &nNumber, sizeof(int));
if (cArray[ 0 ] == 0x01)
Note: This would be appropriate only for those systems which have either little or big endian. But if the system is middle-endian, this code would produce meaningless results.