Home > Article > Backend Development > What is the difference between multidimensional array and jagged array?
Multidimensional array is also called a rectangular array. You can define a 3-dimensional array of integers as -
int [ , , ] val;
Let's see how to define a 2-dimensional array.
int[,] val = new[3,3]
Jagged array is an array of arrays. To access an element from it, just mention the index of that particular array.
Here, we have a jagged array of 5 integer arrays -
int[][] a = new int[][]{new int[]{0,0},new int[]{1,2}, new int[]{2,4},new int[]{ 3, 6 }};
The above is the detailed content of What is the difference between multidimensional array and jagged array?. For more information, please follow other related articles on the PHP Chinese website!