can any one give me simple understanding for table for multi array

0 Mitesh rajput · March 25, 2015

Post a Reply


Oldest  Newest  Rating
0 Dol Lod · March 25, 2015
Try thinking of a multidimensional array as a grid. 

Consider a 2 dimensional array.


int firstarray[][]={{1,2,3},{4,5,6},{7,8,9}};

Now you have created a two dimensional array with 3 rows and 3 columns.
{1,2,3} is the first row in the table.

When you use the first bracket you are referring to which row you want to use in the multidimensional array. The second bracket determines which column you are using.

So firstarray[1[][2]=6 because it is referencing the second row and the third column keeping in mind that array indexes start at 0, not 1. 

For each dimension you use in a multidimensional array,it means you are adding another level of indirection to get there. 

Truthfully, anything you do with a multidimensional array can be done with a one dimensional array. It simply is more convenient for showing what you are doing and simpler access to elements. 

Mathematically, you can think about multidimensional array access as using a grid. This way a two dimensional array could be thought of as having an x and y axis. 3 dimensional array is x,y,and z access. 
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator