C Language

Array Initialization

In C Language by Baqir Ali

Arrays can be initialized within a declaration which is a sequence of initializing values written as a brace-enclosed, comma-separated list.

For Example:

int j[5] = {1, 3, 5, 7, 9}; 
Or we can also use
int j[5];
j[0]=1;
j[1]=3;
j[2]=5;
j[3]=7;
j[4]=9;

Array without Size

If an array is declared without a size and is initialized to a series of values, it is implicitly given the size of the number of initializers. therefore

float j[4] = {1.2, 3.7, 5.4, 7.9}; 
and
float j[ ] = {1.2, 3.7, 5.4, 7.9};