Sizeof 2D Array - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Sizeof 2D Array (
/showthread.php?tid=423758)
Sizeof 2D Array -
CoaPsyFactor - 19.03.2013
Hello there,
I have this array:
pawn Код:
enum _robinfos{
rName[64],
rPay,
Float:rX,
Float:rY,
Float:rZ,
rID
}
new RobInfos[6][100][_robinfos];
And when I want to get size of RobInfos[1] I do this
but from some reason I get this error
Код:
D:\Roleplay\gamemodes\Robbers Stylez.pwn(172) : error 001: expected token: "]", but found "-integer value-"
D:\Roleplay\gamemodes\Robbers Stylez.pwn(172) : warning 215: expression has no effect
4 Errors.
D:\Roleplay\gamemodes\Robbers Stylez.pwn(172) : error 001: expected token: ";", but found "]"
D:\Roleplay\gamemodes\Robbers Stylez.pwn(172) : error 029: invalid expression, assumed zero
D:\Roleplay\gamemodes\Robbers Stylez.pwn(172) : fatal error 107: too many error messages on one line
can anyone tell me what am I doing wrong here...
Re: Sizeof 2D Array -
Stylock - 19.03.2013
Read what the compiler says:
Код:
error 001: expected token: "]", but found "-integer value-"
Re: Sizeof 2D Array -
CoaPsyFactor - 19.03.2013
and? if you see the code there is no open [ left, its sizeof(RobInfos[1]); that means size of sub arrays in one array
Re: Sizeof 2D Array -
RyDeR` - 19.03.2013
Remove the value.
Re: Sizeof 2D Array -
CoaPsyFactor - 20.03.2013
Well I can't, I have RobInfo[6][100][_some_enum], and I need to get all records from RobInfo[6] but if I change RobInfo[6][100][_some_enum] to RobInfo[6][][_some_enum] it crashes compiler.
Re: Sizeof 2D Array -
LarzI - 20.03.2013
What part of the array do you actually want the size of? This is btw an 3D array, not 2D
Re: Sizeof 2D Array -
mastermax7777 - 20.03.2013
try this...
sizeof(RobInfos[])
Re: Sizeof 2D Array -
LarzI - 20.03.2013
Quote:
Originally Posted by mastermax7777
try this...
sizeof(RobInfos[])
|
That would get the size of the 2nd dimension. What he (apparently) wants to do is getting the size of the string inside the enum. My best shot would be either
or
Re: Sizeof 2D Array -
mastermax7777 - 20.03.2013
Quote:
Originally Posted by LarzI
That would get the size of the 2nd dimension. What he (apparently) wants to do is getting the size of the string inside the enum. My best shot would be either or
|
[][][] is not valid, thats 4. he probably wants what i posted before
Re: Sizeof 2D Array -
LarzI - 20.03.2013
- ignore -