Multi Dimensional Arrays

What is Multi Dimensional array in C++?


The Multi Dimensional Array is an array with two or more index values. It is also known as array of arrays. A two dimensional array is also a multi dimensional array.


type array_name[array_size_1][array_size_2]..[array_size_n]

Example :

#include <iostream.h>
void main()
int i,j;
char achar[2] [2] = {'A','r','r','a'};
cout << "Row:: "<< i+1 << "s column::"<<
j+1 <<" element is:: "<< achar[i][j]<< '\n';

Result :

Row:: 1s column::1 element is :: A
Row:: 1s column::2 element is :: r
Row:: 2s column::1 element is :: r
Row:: 2s column::2 element is :: a

In the above example, the character array "achar" is used to display elements of rows, columns using a loop.

C++ Tutorial

Ask Questions

Ask Question