Example 1: 2d array
int a[2][3]= {
{1, 2, 3},
{4, 5, 6}
};
cout << a[1][1];
Example 2: 2d array python
array = [[value] * lenght] * height
array = [[0] * 5] * 10
print(array)
Example 3: c fill 2d array
int disp[2][4] = {
{10, 11, 12, 13},
{14, 15, 16, 17}
};
int disp[2][4] = { 10, 11, 12, 13, 14, 15, 16, 17};
int i, j;
for (i = 0; i < HEIGHT; i++) {
for (j = 0; j < WIDTH; j++) {
disp[i][j] = disp[i][j];
}
}
Example 4: 2d array java
int[][]arr= new int [filas][columnas];
arr.length=filas;
int[][] a = {
{1, 2, 3},
{4, 5, 6, 9},
{7},
};
System.out.println("Length of row 1: " + a[0].length);
System.out.println("Length of row 2: " + a[1].length);
System.out.println("Length of row 3: " + a[2].length);
}
Example 5: 2d arrays | java
int[][] arr = new int[row][column];
Example 6: matrix c declaration
int disp[2][4] = { 10, 11, 12, 13, 14, 15, 16, 17};