array := A data structure containing a number of data
values, of the same type.
int a[10] = {1, 2, 3, 4, 5, 6};
/* inital value of a is {1, 2, 3, 4, 5, 6, 0, 0, 0, 0} */
int a [10] = {0}; // all values in array are 0
int a[10] = {};// WRONG
int a[] = {1,2,3};// implicitly declaring int a[3], and the length is now fixed.int a[15] = { [2] = 29. [9] = 7, [14] = 48}; // all non-designated (not 2, 9 or 14) indices have value 0.The order of designators does not matter.
2 dimensional arrays are stored in row-major order, so row 0 is stored first then row 1 etc.
In initialisation you can omit the inner braces.
in c99 you can use
you do not need the inner braces as the compiler can guess what you are trying to do, but it can make your code less clear
int m[5][9] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1,
1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1}In c99 you can have the length of an array be computed at run time
VLAs can be multi-dimensional, they can’t have static storage duration and it can’t have an initializer.