AI Features

Creating a Two-Dimensional Array

Learn about the implementation of the two-dimensional array.

Two-dimensional arrays

A two-dimensional array is an array of arrays.

Two-dimensional arrays represent a matrix. We can access the element in a two-dimensional array by the row and column index. Both the row and column index start at 0.

Declaration

The general syntax for declaring a two-dimensional array is:

In the 2D array declaration, we specify the data type of an array followed by an array name, which is further followed by the row index and column index in ...