the mathematical notation for a 2-dimensional array that has three rows and three columns. The first row has the values 1, 2, and 3, and the third row has the values 7, 8, and 9.
Declaring this 2-dimensional array with CI is done by putting a comma inside the brackets. The array is initialized by specifying the size of every dimension (also known as rank). Then the array elements can be accessed by using two integers with the indexer:
int[,] twodim = new int[3, 3];
twodim[O, O] 1;
twodim[O, 1] 2;
twodim[O. 2] 3;
twodim[1. O] 4;
twodim[l. I] 5;
twodim[l, 2] 6;
twodim[2. O] 7;
twodim[2. I] 8;
twodim[.2. 2] 9;
You cannot change the rank after declaring an array.
You can also initialize the 2-dimensional array by using an array indexer if you know the value for the elements in advance. For the initialization.of the array, one outer curly bracket is used, and every row is initialized by using curly brackets ~side the outer curly brackets.
When using an array initializer, you must initialize every element of the array. It is not possible to leave the initialization for some values.
By using two commas inside the brackets, you can declare a 3-dimensional array: