wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Let A be a two-dimensional array declared as follows:

A: array [1...10] [1...15] of integer;

Assuming that each integer takes one memory location. The array is stored in row- major order and the first element of the array is stored at location 100. What is the address of the element A [i][j] ?

A
15j + i + 84
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
10i + j + 89
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
15i + j + 84
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
10j + i + 89
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C 15i + j + 84
Let r be the number of elements in a row.

Address of the element A [i][j]
= Base address + (i - 1)* r + (j - 1)
= 100 + (i - 1) × 15 + (j - 1)
= 100 + 15i - 15 + j - 1
= 100 + 15i + j - 16
= 5i + j + 84

flag
Suggest Corrections
thumbs-up
12
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Water for All
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon