I must write a routine for conversion between the 2 representations. But I\'m a bit confused. If I have an architecture with a memory with words of 32 bits and I must store the
A good way to remember "which is which":
Big-endian starts from the big (most-significant) end; little endian starts from the little end.
For example, when regarding the word 0xA15D23B1
as a sequence of bytes, a big-endian machine starts it from the most significant byte 0xA1
. It will be stored at the lowest address (this is the meaning of the potentially confusing word "start").
By the way, if you only want to convert from big-endian to little-endian or back, you don't have to understand this: just reverse the order of bytes! This is why many people don't bother to understand what "big-endian" or "little-endian" means - you generally only need to understand whether or not to swap bytes.