# C # Syntax of Arrangement Arrangements

1

We are seeing multidimensional arrays and I could understand them, but I can not find the syntax for an array arrangement, I want a 3-dimensional array arrangement for example

``````int[][][] tabla = new int[][][];
``````

and I want to access an element of its third dimension as I do here I give an example but with multidimensional arrangement I would need something like that but with an arrangement.

``````//arreglo multi

int[,,] matriz2 = {
{ {1,1,1 },{1,1,1 },{1,1,1 } },
{ {2,2,2},{3,2,88},{4,3,3 } },
{ {2,3,3 }, {2,2,2 }, {2,2,4 } }
};
Console.WriteLine(matriz2[1,1,2]); // salida 88
``````

I add an example of a 2-dimensional array arrangement

`````` //arreglo de arreglo
int[][] tabla = new int[3][];
tabla[0] = new int[1] {1 };
tabla[1] = new int[2] {2,2};
tabla[2] = new int[2] { 3, 3 };

Console.WriteLine(tabla[2][0]); // Salida 3
``````

I want to know how to do it in 3 dimensions and access an element of the 3rd dimension.

here I leave the basis of how it would be 3 dimensions

``````int[][][] tabla = new int[][][];
``````

asked by Shiki 04.04.2017 в 10:22
source

2

It can be converted to an arrangement fix syntax as follows:

``````int[][][] matriz2 = new int [][][] {
new int [][] { new int[] {1,1,1}, new int[] {1,1,1}, new int[] {1,1,1} },
new int [][] { new int[] {2,2,2}, new int[] {3,2,88}, new int[] {4,3,3} },
new int [][] { new int[] {2,3,3}, new int[] {2,2,2}, new int[] {2,2,4} }
};
Console.WriteLine(matriz2[1][1][2]); // salida 88
``````

But as you can see, the syntax is not as compact as the other, because you must include `new int[][][]` , `new int[][]` and `new int[]` at all levels of the expression that initializes the array of fixes.

And, of course, the other change is the way to access `88` with `matriz2[1][1][2]` instead of `matriz2[1,1,2]` .