Burgershot
[Pawn] Better way of doing this ? - Printable Version

+- Burgershot (https://www.burgershot.gg)
+-- Forum: SA-MP (https://www.burgershot.gg/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://www.burgershot.gg/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."modessizeof(Modes));