An array of 2 two byte integers is stored in big endian machine in byte address as shown below. What will be its storage pattern in little endian machine ?
Address Data 0 × 104 78 0 × 103 56 0 × 102 34 0 × 101 12
(A)
0 × 104 12 0 × 103 56 0 × 102 34 0 × 101 78
(B)
0 × 104 12 0 × 103 34 0 × 102 56 0 × 101 78
(C)
0 × 104 56 0 × 103 78 0 × 102 12 0 × 101 34
(D)
0 × 104 56 0 × 103 12 0 × 102 78 0 × 101 34
Answer: (C)
Explanation: In little endian machines, last byte of binary representation of the multibyte data-type is stored first. On the other hand, in big endian machines, first byte of binary representation of the multibyte data-type is stored first.
Since, array of 2 two byte integers, so according to little endian,
0 × 104 56 0 × 103 78 0 × 102 12 0 × 101 34
Option (C) is correct.
Quiz of this Question
Article Tags :
Recommended Articles