I'm trying to output a value as a 4-byte unsigned integer (in little endian form) and am getting confused about something.
If I want to output the number 1 in this form does it appear as:
00000001 00000000 00000000 00000000
OR
10000000 00000000 00000000 00000000
Similarly, if I wanted to output the number 256 would it take the form of:
11111111 00000001 00000000 00000000
I just need clarification. I've read some conflicting things from various places on the internet.
Memory is usually represented as a sequence of discrete bytes, so it doesn't make sense to talk about which bits are adjacent to each other. It's just a matter of display formatting. That said, it's traditional to display the LSB on the right, so in your example it would be
00000001 00000000 00000000 00000000
In hex, which is what you normally use when examining binaries, you'd get
01 00 00 00
Also, in your second example, you accidently represented 511, not 256. The correct bit representation for 256 is
00000000 00000001 00000000 00000000