help [][]
#1

can someone explain what this [][] for? i saw it in few places and i didn't understand what it is...:

new Float:RandomSpawn[][4]

same with weaponsname or something...
Reply
#2

It's specifying an array, specifically a multi-dimensional array in the example you've shown.

It's initializing an array called RandomSpawn, with an unspecified number of cells in the first dimension (the compiler will decide that when you compile it, by how many items are in it), and the second dimension has 4 cells.

Doing this:

pawn Код:
new number1;
new number2;
Is pretty much the same as doing this:

pawn Код:
new number[2];
It is easier to use arrays with loops and use other values to specify a cell within the array than using seperate variables for each bit of information.

You can read more about it in the Pawn documentation available on the CompuPhase website.
Reply
#3

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
It's specifying an array, specifically a multi-dimensional array in the example you've shown.

It's initializing an array called RandomSpawn, with an unspecified number of cells in the first dimension (the compiler will decide that when you compile it, by how many items are in it), and the second dimension has 4 cells.

Doing this:

pawn Код:
new number1;
new number2;
Is pretty much the same as doing this:

pawn Код:
new number[2];
It is easier to use arrays with loops and use other values to specify a cell within the array than using seperate variables for each bit of information.

You can read more about it in the Pawn documentation available on the CompuPhase website.
thx!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)