Representation of One Dimensional Array

Representation of One Dimensional Array in Memory

An array is represented in memory by using a sequential mapping. In sequential
mapping every element is at a fixed distance apart.

representation of one dimensional array

The element at the very first position in the array is called its base address.
Here we have defined an array of five elements of integer type whose first index
element is at base address 100. i.e, the element a[0] is stored at base address
100. Now for calculating the starting address of the next element i.e. of a[1], we
can use the following formula :

Loc (a[j])= base of A + W( j – lower bound)

Here W represents the number of words per memory cell for the array ‘A’.
Observe that the time taken to compute Loc(a[j]) is essentially the same for any
value of j. Hence computer takes same time to access any element of the array.


Suppose we have an array ‘A’ of integer type elements type elements having
size 12 and its first element is stored at location 1500 i.e. its base address is
1500. Now find out the address of the 5^th element.


Loc A[J] = base of ‘A’ + W( J – LB)
J= 4 [array indices starts from 0]
W= 2
Loc A(3) = 1500 + 2 ( 4 – 0 ) = 1580