Ask a Teacher



consider the single dimension array AAA[45] having base address 300 and 4 bytes is the size of each element of the array. find the address of AAA[10],AAA[25]and AAA[40].

lb=0, b=300, s=4 bytes. 
AAA [I] = b + (l - lb)*s 
AAA [10] = 300 + (10-0)*4 = 340 
AAA [25] = 300 + (25-0)*4 = 400 
AAA [40] = 300 + (40-0)*4 = 460.

The addresses of AAA [10], AAA [25], AAA [40] are 340, 400 and 460 respectively.


comments powered by Disqus