The Three dimensional array can be declared as
• Like the one-dimensional arrays, three-dimensional arrays may be initialized by following their declaration with a list of initial values enclosed in braces.
int table[2][2][3] = {0,0,0,1,1,1,6,6,6,7,7,7};
• This initializes the elements of first two dimensional(matrix) first row to zero’s and the second row to one’s and second matrix elements are first row to six’s and the second row to seven’s.
• This initialization is done row by row.
• The above statement can be equivalently written as
int table[2][3] = {{{0,0,0},{1,1,1}},{{0,0,0},{1,1,1}}}
• We can also initialize a two – dimensional array in the form of a matrix as shown.
int table[2][3] = {
{
{0,0,0},
{1,1,1}
},
{
{6,6,6},
{7,7,7}
}
} ;