• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Getting the size of an array
#1
I have a multi-dimensional array, and I want to get the size of each line.

Code:
new BusRoutes[][] = {
? ? {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
? ? {0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 10}
};


Code:
new const MaxStops[] = sizeof(BusRoutes[]);

Code:
format(sStops, sizeof(sStops), "Stops: 0/%d", MaxStops[vRoute]);

If vRoute = 0, it works fine, but if it equals 1, the function crashes and it doesn't continue running the rest of the function. Something is wrong with MaxStops[vRoute] if vRoute equals anything other than 0.

What am I doing wrong?
  Reply


Messages In This Thread
Getting the size of an array - by Torque - 2021-04-16, 02:37 PM
RE: Getting the size of an array - by Torque - 2021-04-16, 03:11 PM
RE: Getting the size of an array - by Radical - 2021-04-16, 08:03 PM
RE: Getting the size of an array - by Torque - 2021-04-16, 08:39 PM

Forum Jump: