InterviewSolution
Saved Bookmarks
| 1. |
The array D [-2…10][3…8] contains double type elements. If the base address is 4110, find the address of D [4] [5], when the array is stored in Column Major Wise. |
|
Answer» D [-2… 10] [3 …8] BaseAddress B = 4110 I = 4, J = 5 D [4] [5] = ? W = 8 bytes M = 10 Columnwise D[I, J] = B + ((J – 1) * M + (I – 1)) * W D [4] [5] = 4110 + ((5 – 1) + 10 + (4 – 1)) * 8 = 4110+ (40 + 3) × 8 = 4110 + 344 = 4454 |
|