In this C++ tutorial, you will learn about Multidimensional arrays, what is Multidimensional array, how is Multidimensional arrays represented in C++, how to access the elements of a Multidimensional array.
A Multidimensional array is an array of arrays.
Suppose a programmer wants to represent the two-dimensional array Exforsys as an array with three rows and four columns all having integer elements. This would be represented in C++ as:
It is represented internally as:Exforsys Data Type: int
Based on the above two-dimensional arrays, it is possible to handle multidimensional arrays of any number of rows and columns in C++ programming language. This is all occupied in memory. Better utilization of memory must also be made.
At first, it goes through the elements for ROW 1, with all the COLUMNS from 1 to the max value (3), then procedes to the next value of the ROW which is 2, and the COLUMNS from 1 again to the max value. This ends when the ROW reaches the max value of 4, and COLUMNS the max value of 3.
In the above example, the keyword const (specifying constant) precedes the data type that specifies the variable ROW and COLUMN to remain unchanged in value throughout the program. This is used for defining the array Exforsys ROW size and COLUMN size, respectively.