There will be two different types (let's assume your element type is integer):
int[][]
and
int[,]
.
As you hardly understand topic, start with 2D array (the other way allows for jagged array):
int [,] array = new int[4, 12];
array[2, 11] = 212;
The jagged array
int[][]
is not really a 2D array: this is an array of integer arrays. Both inner and outer arrays are 1D. If you think about this words and experiment a bit, you will find a way around them: you initialize outer array (array of array with 1D rank
R
) and then do the cycle
0
to
R
and initialize every inner array with any (different!) lengths. That's why it's called "jagged": inner arrays all have different lengths.
—SA