972 views
1 votes
1 votes

Can anyone please verify whether I have calculated the addresses correctly or not?
 

 

1 Answer

3 votes
3 votes
let array for column major order is a[layers][columns][rows]

base address is 100  and size of each element is 4 bytes

number of layers=-28-(-29)+1=2

number of columns -25-(-27)+1=3

number of rows=-21-(-24)+1=4

a-1=100-4*3*4=100-48=52

&a-1=100-4*4*3*2=100-96=4

a+2=100+2*(4*3*4)=100+96=196

&a+2=100+2*(4*2*3*4)=100+192=292

*a+3=100+3*(4*4)=100+48=148

&(*a)+3=a+3=100+3*(4*3*4)=100+144=244

*(*a)+3=100+3*4=100+12=112

*(a+3)+2=*(100+3*(4*3*4))+2=*(144)+2=144+4*2*4=144+32=176

**a+1=100+4*1=100+4=104

&(**a)+2=*a+2=100+4*2*4=100+32=132

&(***a)+3=**a+3=100+3*4=100+112

Related questions

13 votes
13 votes
8 answers
2
Na462 asked Aug 22, 2018
5,570 views
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...
1 votes
1 votes
1 answer
3
Pankaj Joshi asked Jan 25, 2017
314 views