Saturday, 24 March 2012

Arrays, Array Declaration, Operating on Array


Arrays:-

          An array is a collection of two or more adjacent memory locations containing same type of data. These memory locations are called array elements which are given a particular symbolic name.

          Note:-
                   An array is a collection of similar data types or elements addressed by a common variable name.

Array Declaration:-

          To set up an array, we need to declare both the name of the array and number of cells or size of this array.

          Syntax:-     data type  vari[index];

          In order to manipulate data stored in an array. We reference each individual element of the array by specifying the array name and identify the element desired by a subscript (number index). The index set consist of integer 0,1,2,3,--------etc.

Operating on Array:-

          The operations performed on linear structure (array) are:-
  • Traversal:-  Processing each element in the array or list.
  • Search:-    Finding the location of the element with a given value with a given key.
  • Insertion:-  Adding a new element to the list.
  • Deleting:-   Removing an element from list.
  • Sorting:-  Arranging the element in some type of order, ascending or descending.
  • Merging:-  Combining two lists of array within a single list or array.


No comments:

Post a Comment