Bi-Dimensional Arrays

Arrays can be bi-dimensional, meaning that their elements are indexed according to a row-column rule. The following statement:
int array2D[10][20];
defines an array of 10 by 20 int elements, distributed according to a 10 row 20 column disposition. In order to assign to the fourth row – thirteenth column element the value 43, one can write:
array2D[3][12] = 43;
In order to retrieve, and print out, such an element’s value, one can type:
cout << array2D[3][12];


Example


#include <iostream>
using namespace std;

int main()
{   
     int array2D[10][20];
     array2D[3][12] = 43;
     cout << "4th row, 13th column: " << array2D[3][12];
}

Output

4th row, 13th column:: 43