in Programming in C retagged by
431 views
3 votes
3 votes
If the $32$-bit number given below is stored in little-endian at address $1000,$ what is the value of the byte at address $1002?$ Answer in decimal.
$$0001\; 0010 \;0011\; 0100\; 0101\; 0110\; 0111\; 1000$$
This number is the same as $12345678$ in hexadecimal.
in Programming in C retagged by
431 views

1 Answer

4 votes
4 votes

Given 32b number 0x 12345678 is stored at location 1000 in little endian format.

At 1000, 0x 78 is stored (not 87).

At 1001, 0x 56 is stored.

At 1002, 0x 34 is stored.

At 1003, 0x 12 is stored.

At 1002, 0x 34 is stored, which is equivalent to 3 * 16 + 4 = 52 in decimal.

Answer :- 52

2 Comments

Why is is 78 and not 87? Can you please explain this part?
Thanks.
0
0
The endian system dictates whether we store MSB to LSB or LSB to MSB starting at some memory location.

$0x78$ is $1$ whole Byte, we do not alter the nibbles of a Byte, we store them as they are.
0
0
Answer:

Related questions