Multi-dimensional Arrays
Learn to use arrays of arrays in C++.
What is a multi-dimensional array
In C++, a multi-dimensional array is an array that contains other arrays as its values or members. The container array is termed an outer array, and the member array is termed an inner array. An array is said to be a multi-dimensional array if it has another array as its members. Can you think of some instances where we might have been using a structure same as a multi-dimensional array? One such example is a crossword puzzle!
Individual values in multi-dimensional arrays
The individual values in a multi-dimensional array are accessed through multiple index numbers used in the following format:
arrayname[row number][column number];
Let’s take the example of the following array:
int array1[2][3]= {
{10,12,14},
{16,18,20}
};
-
The
array1...
Ask