Put a 1 in an unsigned int.
Add three bytes to the address of the int.
Assign the contents of that address to an unsigned char.
If your 1 is there, you are big endian.
Not necessarily, you could just have a random 1 on the stack.
Try using a union with a 4 byte char and a long. Put 1 in the long and then check where the one showed up on the 4 byte char. Zeroth byte is little endian, third byte is big endian.
BTW, this trick only sorta works. There are processors that you can map different regions of memory to be big or little endian. The hardware does everything for you.
Also there are some processors out there that do it on a bit rather then on a byte level. I don't know which, but there is literature stating that this design exists.
To further complicate things, apparently floating point and integer endianness don't have to coincide.
Adrian