Basics of Array
Link will be apear in 15 seconds.
Well done! you have successfully gained access to Decrypted Link.
Linear
Array:
Homogeneous data:
a) Elements are represented through
indexes.
b) Elements are saved in sequential in
memory locations.
Number of elements, N –> length or
size of an array.
If:
UB : upper bound ( the largest
index)
LB : lower bound (the smallest
index)
Then: N = UB – LB + 1
Length = N = UB when LB = 1
All elements in A are written
symbolically as, 1 .. n is the subscript.
A1, A2, A3, .... , An
In FORTRAN and BASIC à A(1), A(2), ..., A(N)
In Pascal, C/C++ and Java à A[0], A[1], ..., A[N-1]
subscript starts from 0
LB = 0, UB = N–1
Advantages of an Array:
Very simple
Economy – if full use of memory
Random accessed at the same time
Disadvantage of an
Array:
wasting memory if not fully used