c assign value to array code example
Example 1: 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} ,
{4, 5, 6, 7} ,
{8, 9, 10, 11}
};
Example 2: how to initialize an array in c
double balance[5] = {1000.0, 2.0, 3.4, 7.0, 50.0};