Tuesday 8 July 2014

SINGLE- DIMENSIONAL ARRAY

SINGLE- DIMENSIONAL ARRAY

  • IT IS SOMETIMES CALLED A LIST.
  • IT IS A COLLECTION OF SIMILAR DATA TYPES.
  • IT IS THE SIMPLEST FORM OF AN ARRAY.
  • DECLARATION PART :-
Specify its name , size and data types of the item.

SYNTAX :-
        storage_class data_type array_name[size];

EXAMPLE:-
        int arr[ 20 ];
        float array[40];
        int X[5] ={ 2,3,4,5,6 };

NOTE- 
Array elements are accessed by their index value. The index of an array starts from zero.
int marks[4] = { 70,80,90,85 };
The value 70 lies in the index position zero and 85 lies in index position three ( n - 1 ).

No comments:

Post a Comment