Example 1: multidimensional array
int a[2][3]= {
{1, 2, 3},
{4, 5, 6}
};
cout << a[1][1];
int a[2][3][2]= {
{ {1, 2},
{2, 3},
{4, 5}
},
{ {6, 7},
{8, 9},
{10, 11}
}
};
cout << a[0][1][1];
Example 2: Multidimensional array in java
public class TwoDimensionalStringArray
{
public static void main(String[] args)
{
String[][] animals = {
{ "Lion", "Tiger", "Cheetah" },
{ "Deer", "Jackal", "Bear" },
{ "Hyena", "Fox", "Elephant" } };
for(int a = 0; a < animals.length; a++)
{
System.out.print(animals[a][0] + " ");
for(int b = 1; b < animals[a].length; b++)
{
System.out.print(animals[a][b] + " ");
}
System.out.println();
}
}
}
Example 3: Multidimensional array in java
public class SimpleTwodimensionalArray
{
public static void main(String[] args)
{
int[][] arrnumbers = {{2, 4},{6, 8},{10, 12}};
System.out.println("Two dimensional array in java: ");
for(int a = 0; a < 3; a++)
{
for(int b = 0; b < 2; b++)
{
System.out.println(arrnumbers[a][b]);
}
}
}
}
Example 4: javascript define multidimensional array
var iMax = 20;
var jMax = 10;
var f = new Array();
for (i=0;i<iMax;i++) {
f[i]=new Array();
for (j=0;j<jMax;j++) {
f[i][j]=0;
}
}
Example 5: matrix c declaration
int disp[2][4] = { 10, 11, 12, 13, 14, 15, 16, 17};
Example 6: javascript multidimensional array
var items = [
[1, 2],
[3, 4],
[5, 6]
];
console.log(items[0][0]);
console.log(items[0][1]);
console.log(items[1][0]);
console.log(items[1][1]);
console.log(items);