• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Better way of doing this ?
#1
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);
  Reply
#2
You can just use the name of the enum. This prints the same values:

PHP Code:
printf("NumElements %d, sizeof %d."modessizeof(Modes)); 
Always keep in mind that a lot of people are active on this forum in their spare time.

They are sacrificing time they could easily spend on things they would rather do, to help you instead.

  Reply


Forum Jump: