how to initialize a 2d array code example
Example 1: 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 2: matrix c declaration
int disp[2][4] = { 10, 11, 12, 13, 14, 15, 16, 17};
Example 3: double array in c
int disp[2][4] = {
{10, 11, 12, 13},
{14, 15, 16, 17}
};
Example 4: declare matrix in java
int[][] multi = new int[5][];
multi[0] = new int[10];
multi[1] = new int[10];
multi[2] = new int[10];
multi[3] = new int[10];
multi[4] = new int[10];