1.

Calculate the address of X[4,3] in a two-dimensional array X[1….5, 1…..4] stored in row=major order in the main memory. Assuming base address to be 1000 and that each requires 4 words of storage. 

Answer»

X[4][3]=B+W(C(I-1)+(J-1))

=1000+4(4(4-1)+(3-1))

=1000+4(4(3)+(2))

=1000+56

=1056



Discussion

No Comment Found

Related InterviewSolutions