sizeof(myArray[0])
#1

I need to get how many numbers are in each row, they aren't all the same.

pawn Code:
new myArray[][] = {
{1, 2, 3, 4, 5},
{1, 2, 3},
{6, 9},
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
};
I want to be able to do 'sizeof(myArray[0])' and get 5, but I get:

Quote:

error 001: expected token: "]", but found "-integer value-"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero

All on this line:

pawn Code:
new myVar = sizeof(myArray[0]);
So annoying. I must be mis-understanding how arrays work or something. What can I do to get around this?
Reply


Messages In This Thread
sizeof(myArray[0]) - by MP2 - 30.09.2011, 17:01
AW: sizeof(myArray[0]) - by Nero_3D - 30.09.2011, 17:41
Re: sizeof(myArray[0]) - by MP2 - 30.09.2011, 17:46

Forum Jump:


Users browsing this thread: 2 Guest(s)