sizeof in multi-dimensional array - error?
#1

I have a multi-dimensional array looking like this..
Код:
new PedCategories[][][] = {
// male
{
    // asian
    {49,57,58...}
    // black
    {...}
    // hispanic
    {...}
    // white
    {...}
}
// female
{
    // asian
    {...}
    // black
    {...}
    // hispanic
    {...}
    // white
    {...}
}
I'm trying to access the skin IDs by first counting how many skins are in any array...
Код:
i = sizeof(PedCategories[male][black]);
Instead of compiling code to count how many black males there are, Pawno decided it would be easier to throw this error:
Код:
***.pwn(436) : error 001: expected token: "]", but found "-identifier-"
***.pwn(436) : warning 215: expression has no effect
***.pwn(436) : error 001: expected token: ";", but found "]"
***.pwn(436) : error 029: invalid expression, assumed zero
***.pwn(436) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Any reason for this?
Reply
#2

post only your 436 line
Reply
#3

I already did.. The one right above the error list.
Reply
#4

pawn Код:
i = sizeof(PedCategories[][]);
Reply
#5

Ahh, I get it. The array size adopts the largest dimension containing the skins. I was thinking as if they were arrays inside arrays, which could have variable sizes..

Turns out I'd need a string with 3200 cells to do what I'm planning.. hmm...

Thanks.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)