Linear Arrays


A linear array is a list of a finite number ‘n’ of homogeneous data elements (i.e. data elements of same type) such that: 
  • The elements of the arrays are referenced respectively by an index set consisting of ‘n’ consecutive numbers.
  • The elements of the array are stored respectively in successive memory location.
  • The length or the number of data element of the array can be obtained from the index set by the formula:
Length = UB – LB + 1

Where upper bound (UB) is the largest index, and LB is the smallest index, called the lower bound, of the array.
Note that length = UB when LB = 1.
Example: 

A[5] is an array.
     
So according to the above example, UB=5, LB=1 so the  length of array = 5 – 1 + 1 = 5.
Powered by Blogger.