April 2018
Intermediate to advanced
292 pages
6h 44m
English
The arrays in the C# language do not need to have only one dimension. It is also possible to create two-dimensional or even three-dimensional arrays. To start with, let's take a look at an example regarding the declaration and initialization of a two-dimensional array with 5 rows and 2 columns:
int[,] numbers = new int[5, 2];
If you want to create a three-dimensional array, the following code can be used:
int[, ,] numbers = new int[5, 4, 3];
Of course, you can also combine a declaration with an initialization, as shown in the following example:
int[,] numbers = new int[,] =
{
{ 9, 5, -9 },
{ -11, 4, 0 },
{ 6, 115, 3 },
{ -12, -9, 71 },
{ 1, -6, -1 }
};
Some small explanation is necessary for the way you access particular ...