One Dimensional Array
A list of items can be given one variable name using one subscript and such a variable is called a single-subscripted variable or a one-dimensional array. For example, suppose if we want to represent a set of numbers, say (20, 10, 24, 26, 34), by array variable number, then we may declare the variable number as follows
int number[5];
and the computer reserves five storage locations as shown below:
number[0]
|
number[1]
|
number[2]
|
number[3]
|
number[4]
|
The values to the array element can be assigned as follows
number[0]=20;
number[1]=10;
number[2]=24;
number[3]=26;
number[4]=34;