+ 1

How can we define a bidimensional array?

26th Jul 2016, 1:01 PM
Ricardo Pucca
Ricardo Pucca - avatar
3 Réponses
+ 2
I search two ways to declare: int [,] arr1 = new int[3,4]; int [,] arr2; arr2 = new int[2,3];
28th Jul 2016, 2:30 AM
Ricardo Pucca
Ricardo Pucca - avatar
+ 1
Thanks Julio.
28th Jul 2016, 8:43 PM
Ricardo Pucca
Ricardo Pucca - avatar
0
yup, you can also do it this way: int[,] arreglo = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}; the dimensions length are like: int[,] arreglo = new int[3,4]; remember the index starts at 0 so if... int x = arreglo[1,2]; x would be 7 not 2 😀 and you can always get the bigger index of a dimension with arreglo.Getupperbound(0); in this case it's 2 arreglo.Getupperbound(1); it's 3 so the last position is arreglo[2,3];😀 and last the length of each dimension with arreglo.GetLongLength(0); it's 3😀 I'm not so good with English...😅 Hope you find this useful😊
28th Jul 2016, 6:13 AM
Julio González
Julio González - avatar