...

/

Initializing Arrays

Initializing Arrays

Explore different methods for initializing arrays in C.

Defining and initializing arrays in one step

Like a normal variable, an array can also be defined and initialized at the same place. The values being initialized should be written in a pair of { }. When an array is defined and initialized at the same place, mentioning its size is optional.

dataType arrayName[size] = {value1,  value2,.....,valueN} ;
Access this course and 1400+ top-rated courses and projects.