multi array
#1

hey all

I have multi array like that:

array[5][5] and i want to do something like that :

array[5][5] = {-1,...) and all the array be -1 example

array[0][3] == -1;
array[2][3] == -1;
array[4][1] == -1;

all will be -1 if someone can send me how that be very good
Reply
#2

Код:
for(new i = 0; i < 5; i++)
{
  for(new j = 0; j < 5; j++)
  {
    array[i][j] = -1;
  }
}
Reply
#3

Quote:
Originally Posted by MellowHammer
Посмотреть сообщение
Код:
for(new i = 0; i < 5; i++)
{
  for(new j = 0; j < 5; j++)
  {
    array[i][j] = -1;
  }
}
have another way?
Reply
#4

pawn Код:
new array[5][5] = {{-1, ...}, {-1, ...}, {-1, ...}, {-1, ...}, {-1, ...}};
but if you got huge arrays its bad idea
Reply
#5

Quote:
Originally Posted by Jefff
Посмотреть сообщение
pawn Код:
new array[5][5] = {{-1, ...}, {-1, ...}, {-1, ...}, {-1, ...}, {-1, ...}};
but if you got huge arrays its bad idea
[MAX_VEHICLE][4] its huge?
Reply
#6

Considering that are:
2000 MAX VEHICLE set , i think yeah.... is kinda big...
Reply
#7

Quote:
Originally Posted by XStormiest
Посмотреть сообщение
Considering that are:
2000 MAX VEHICLE set , i think yeah.... is kinda big...
so what the best option to do that.
Reply
#8

Its ok because you need write only 4 times {-1, ...}, {-1, ...} not 2000 times, for example

[4][MAX_VEHICLE] = { {-1, ...}, {-1, ...}, and 1998 times this xd};
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)