Multi-dimensional Arrays
Explore the concept of multi-dimensional arrays in C++, including how to declare, access, and manipulate arrays within arrays. Learn practical examples such as matrices and exercises on summing rows and columns, enhancing your ability to handle complex data structures.
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}
...