c assign array

Solutions on MaxInterview for c assign array by the best coders in the world

showing results for - "c assign array"
Emilie
29 May 2017
1model : 
2type arrayName[arraySize] = {value1, value2, ..., valuearraySize};
3
4example : 
5
6double balance[5] = {1000.0, 2.0, 3.4, 7.0, 50.0};
7
8for multi dimensional arrays :
9type arrayName[size1][size2] = {{value11, value12, ..., value1size2}, {value21, value22, ..., value2size2}, ..., {valuesize11, valuesize12, ..., valuesize1size2}};
10
11example : 
12int a[3][4] = {  
13   {0, 1, 2, 3} ,   /*  initializers for row indexed by 0 */
14   {4, 5, 6, 7} ,   /*  initializers for row indexed by 1 */
15   {8, 9, 10, 11}   /*  initializers for row indexed by 2 */
16};