Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
2.8k views
in Computer by (69.4k points)

Each element of two-dimensional array (with 5 rows and 4 columns) is stored in one memory location. If A(1,1) is at location 2000, what is the address of A(4,4) ? The arrangement is row-major. Use a suitable formula for the calculation.

1 Answer

+1 vote
by (61.3k points)
selected by
 
Best answer

A[5][4] => rows R=5, columns C=4

Let base address be B

Given element width W=1 bytes and A[1][1]=2000

In Row major,

A[I][J]=B+W(C(I=lr)+(j-lc))

where lr=lowest row and lc=lowest column 

A[1][1]=B+W(C(1-0)+(1-0))

2000=B+1(4(1)+1)

2000=B+5

Base Address B=2000-5=1995

Using same formula

 A[4][4]=1995+1(4(4-0)+(4-0)) 

=1995+20

=2015

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...