5,469 views
13 votes
13 votes
Consider a 2 dimensional array A[40...95,40...95] in lower triangular matrix representation. The size of each element of array is 1 Byte.If array is implemented in memory as Row major,with base address as 1000,the address of A[66][50] is .....

Ans. 1361

8 Answers

0 votes
0 votes
I think answer should be 2466 because given array is 2 dimensional then doesn't matter it is lower triangular,upper triangular or diagonal matrix as all 0's also require 1 B of memory,hence the address of A[66][50] will be:

1000+[(50-40)+(95-40+1)*(66-40)] = 2466
0 votes
0 votes
total element in all rows from row 40 to row 65 :-

26*27/2=351

elements in row 66 are (50-40+1) =11

so address should be :-

1000+(351+11)*1

1362
0 votes
0 votes
$a[40...95,40...95]$

$loc[66][50]:RMO$

Make changes to approach in a different way.

$a[0...55,0...55]$

$loc[26][10]:RMO$

$0^{th}\ row=1$

$1^{st}\ row=2$

$2^{nd}\ row=3$

.

.

.

$25^{th}\ row=26$

$Sum=1+2+3....+26=351$

Now you are standing on $26^{th}$ row and it's first element will start from $0^{th}$ column but you need to go to $10^{th}$ column, hence add $10(0,1,2....9)$

$351+10=361$

$361+1000=1361$

Related questions

1 votes
1 votes
1 answer
1
Balaji Jegan asked Jun 27, 2018
932 views
Can anyone please verify whether I have calculated the addresses correctly or not?
1 votes
1 votes
2 answers
2
Ahsanul Hoque asked Feb 17, 2019
1,285 views
Tell me the difference :&(arr+1) and &arr+1
0 votes
0 votes
1 answer
4
shivam sharma 5 asked Aug 28, 2018
549 views
give the complete solution with explanationint main(){ int arr = {10,2,3,4,5,6,7,8}; int *p, *q; p = &arr ; q = (int*) arr; printf("%d ,%d \n",*p...