As part of an exercise to play with binary and ascii formats, I wrote the integer 49 to a file using a C program. In binary, its 4 byte representation is
00000000 00000000 00000000 00110001
In ascii, the first 3 bytes are null bytes (displayed as ^@
), and the last byte is the character 1
. When I opened this in vim, I expected to see three null bytes, followed by 1
. Instead, I saw it reversed, that is, 1
followed by three null bytes. Why is it so?