Multi - Dimensional Array
Introduction
Multidimensional array is an array, which contains one or more arrays.
Multi-Dimensional Array Declaration
Syntax
We can declare 2-Dimenesional, 3-Dimensional and any No. of Dimensional array.
Example
We are Creating a Array, Which stores the Name, Age and Gender of 3 peoples.
In this way, Arrays with unique index are declared.
Accessing The Multi-Dimensional Array Elements
To Access or Print Element in Array, We should know the Index of Element.
Syntax
Here,
Inside Square Brackets Index of the Element should be placed.
Let's Understand How to Find The Index of Multi-Dimensional Array :
For Example : If it is 2-Dimensional Array, Then you should imagine
2-D Dimensional Array
For Example : If it is 3-Dimensional Array, Then you should imagine
3-D Dimensional Array
Example:
Now Try to Visualize This 3-D Dimensional Array.
Copy of 3-D Dimensional Array
Iteration Through Multi Dimensional Array
We, will be using Nested for Loop.
Printing All Elements of Multi-Dimensional Array.