Three-Dimensional Array in C

Two-dimensional array of four one-dimensional arrays, each of which contains two integers. In other words, a one-dimensional array of two elements is constructed first. Then four such one dimensional arrays are placed one below the other to give a two dimensional array containing four rows. Then, three such two dimensional arrays are placed one behind the other to yield a three dimensional array containing three 2-dimensional arrays.

Initialising a Three-Dimensional Array

 Three Dimensional Array
three dimensional array

int arr[3][4][2] = {
{
{ 2, 4 },
{ 7, 8 },
{ 3, 4 },
{ 5, 6 }
},
{
{ 7, 6 },
{ 3, 4 },
{ 5, 3 },
{ 2, 3 }
},
{
{ 8, 9 },
{ 7, 2 },
{ 3, 4 },
{ 5, 1 },
}
}

Leave a Comment