What is Array Initialization?

The Element of array are initialized in the same way as the ordinary variables.

Example:

int num[6]={2,4,5,35,12,12,67};

An example showing the index and its corresponding data (prices) >

An example program of entering data into Array:

Out put of the program

In this example, using the for loop, the process of asking and receiving the marks is accomplished.

When the count has the value 0, the scanf() statement will cause the cvalue to be stored at num[0].

The process continues until count has the value greater than 5.

Reading data from Array

In the above program we enter the data into an Array. Now to read value from this array , we will again use for Loop.

The below program segment explains the retrieval of the values from the array: