Arrays question!
#3

This is called Multidimensional Array, it is something like, an array inside another array.

pawn Code:
new Array[3][5];
Above you can see a two-dimensional array. In a two-dimensional array, it is convenient to think of the first subscript as being the row, and the 2nd subscript as being the column. Example:

Code:
[0][0]  [0][1]  [0][2]  [0][3]  [0][4]
[1][0]  [1][1]  [1][2]  [1][3]  [1][4]
[2][0]  [2][1]  [2][2]  [2][3]  [2][4]
It is like you have 15 different arrays.

Example of use:

pawn Code:
new Array[3][5];

Array[0][0] = 1;
Array[1][0] = 3;
Array[2][4] = 9;
Array[1][2] = 3;

if(Array[0][0] == Array[1][0])//This returns false!
{
    //...Something
}

if(Array[1][0] == Array[1][2])//But this returns true!
{
    //...Something
}
Hope i could clarify a bit.
Reply


Messages In This Thread
Arrays question! - by Kush - 09.09.2012, 17:43
Re: Arrays question! - by leonardo1434 - 09.09.2012, 17:50
Re: Arrays question! - by Larceny - 09.09.2012, 18:02
Re: Arrays question! - by Vince - 09.09.2012, 18:24
Re: Arrays question! - by Finn - 09.09.2012, 19:10

Forum Jump:


Users browsing this thread: 1 Guest(s)