assign to array c code example

Example: c assign array

model : 
type arrayName[arraySize] = {value1, value2, ..., valuearraySize};

example : 

double balance[5] = {1000.0, 2.0, 3.4, 7.0, 50.0};

for multi dimensional arrays :
type arrayName[size1][size2] = {{value11, value12, ..., value1size2}, {value21, value22, ..., value2size2}, ..., {valuesize11, valuesize12, ..., valuesize1size2}};

example : 
int a[3][4] = {  
   {0, 1, 2, 3} ,   /*  initializers for row indexed by 0 */
   {4, 5, 6, 7} ,   /*  initializers for row indexed by 1 */
   {8, 9, 10, 11}   /*  initializers for row indexed by 2 */
};

Tags:

C Example