Multidimensional Array - C Tutorial

Multidimensional Array

Arrays can have more than one dimension. For example, the following declaration creates a two-dimensional array of four rows and two columns.

  int array[4][2];

The following declaration creates an array of three dimensions, 4, 2, and 3.

  int array[4][2][3];

Array Initialization

You can initialize the array upon declaration, as is shown in the following example.

     int array2D1[4][2]={ {10,1},  {20,2},  {30,3}, {40,4} };
     int array2D2[4][2]={ 10,1,20,2,30,3,40,4};