Is it possible to use char-array in multidimensional array?
#1

I'm trying to use multi-d array with char. But it somehow gives me an error(or warning).
pawn Код:
new var[MX_PLAYERS char][4];

var{playerid}[0] = 1; //warning/error
So it there any way to use char array in multi-d array?
Reply
#2

pawn Код:
var{playerid}[0] = 1;
should be

pawn Код:
var[playerid][0] = 1;
Reply
#3

That wouldn't be char-array then.
Reply
#4

Quote:
Originally Posted by Mattakil
Посмотреть сообщение
pawn Код:
var{playerid}[0] = 1;
should be

pawn Код:
var[playerid][0] = 1;
You didn't even read the post, did you? He is trying to make a CHAR array, not a regular array!

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
I'm trying to use multi-d array with char. But it somehow gives me an error(or warning).
pawn Код:
new var[MX_PLAYERS][4];

var{playerid}[0] = 1; //warning/error
So it there any way to use char array in multi-d array?
Well, from what i can see, the array you have there is not a char array :3 (It's just a regular multi-d array. Perhaps actually adding the "char" in there would help? :3
Reply
#5

Oh wait, edited my main post. Was a mistake ;q
Reply
#6

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
I'm trying to use multi-d array with char. But it somehow gives me an error(or warning).
pawn Код:
new var[MX_PLAYERS char][4];

var{playerid}[0] = 1; //warning/error
So it there any way to use char array in multi-d array?
Wouldn't "var{playerid}[0]" automatically be considered "1" hypothetically speaking, since arrays always count [0] as the first item?
Reply
#7

Make the second dimension the char. Same memory used.
Reply
#8

So.. var[MAX_PLAYERS char][5 char] = Same memory used?
Reply
#9

Not like that, it should be:
pawn Код:
new var[MAX_PLAYERS][4 char];
pawn Код:
var[playerid]{0} = 1;
In bigger sizes, it makes difference.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)