An array is used when we need to handle similar types of data. It is defined as a sequence of variable that can store value of one particular data type. To define an array, we use this guide:
type   array_name[size];
For example, if we want to make an array to enter the age of 5 people, we write it like this:
int   age[5];
The resulting array can be represented the first image of the top. 

This array has 5 elements in it, but notice that the first element in the array is age[0]. This is true for any array we create. Also, we can initialize an array at the time of declaration. This means, we can enter the data that goes in each element since we declare the array, for example:
int   age[5]  =  {12,  16,  7,  14,  10};
Example: Program to store 5 numbers entered by the user in an array and display first and last number only. (Second image on the top)

CC BY 4.0 An array is used when we need to handle similar types of data…. by lowercase is licensed under a Creative Commons Attribution 4.0 International License.