Previous | Home | Next |
What are Multidimensional arrays ?
Multidimensional arrays are often known as array of the arrays. In multidimensional arrays the array is divided into rows and columns, mainly while considering multidimensional arrays we will be discussing mainly about two dimensional arrays and a bit about three dimensional arrays. In 2-D array we can declare an array as :
where first index value shows the number of the rows and second index value shows the no. of the columns in the array. To access the various elements in 2-D we can access it like this:
In 3-D we can declare the array in the following manner :
/* here we have divided array into grid for sake of convenience as in above declaration we have created 3 different grids, each have rows and columns */
If we want to access the element the in 3-D array we can do it as follows :
Previous | Home | Next |