+ 1

HELP using Multi-Dimensional Arrays 🙋🙋🙋

int[ ][ ] myArr = { {1, 2, 3}, {4}, {5, 6, 7} }; Is the array is double dimensional, or 3D array? Since it's having 3 arrays!! If not, how can you distinguish between 2D and 3D array on the basis of syntax, and how to access the elements !!

31st Aug 2020, 2:32 AM
I M J
I M J - avatar
1 ответ
0
int[] oneDimensional; int[][] twoDimensional; int[][][] threeDimensional; oneDimensional = { 1 }; //one level deep twoDimensional = { oneDimensional, { 2 } }; //two levels deep threeDimensional = { twoDimensional, { { 3 } } }; //three levels deep
31st Aug 2020, 7:05 AM
BlazingMagpie
BlazingMagpie - avatar