open.mp forum
[Pawn] Better way of doing this ? - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Pawn] Better way of doing this ? (/showthread.php?tid=696)



Better way of doing this ? - mouiz - 2019-07-07

Is there a better way of getting the size of an enum ?


Code:
enum modes { ? ??MODE_fgrs, ? ? MODE_gdsrg, ? ? MODE_lol, ? ? MODE_third }; new Modes [modes]; new size = sizeof (Modes);



RE: Better way of doing this ? - Freaksken - 2019-07-07

You can just use the name of the enum. This prints the same values:

PHP Code:
printf("NumElements %d, sizeof %d.", modes, sizeof(Modes));