What does it mean to define an array with enum variable as array size?
For example I have the following code:
typedef enum
{
  D_ROM_RDE_GROUP_0 = 0x0,
  D_ROM_RDE_GROUP_1,   
  D_ROM_RDE_MAX_GROUPS
}E_ROM_RDE_GROUPS;
U_08 pPlaneCopy[D_ROM_RDE_MAX_GROUPS];
I don't understand it...
Thanks for the help.
The first thing to remember is that enumeration values are compile-time constant. The other thing is that enumeration values (unless initialized to a specific value) increases. So in your case D_ROM_RDE_GROUP_0 is equal to 0, D_ROM_RDE_GROUP_1 is equal to 1 and D_ROM_RDE_MAX_GROUPS is equal to 2.
This means that when you declare the array, it's basically the same thing as
U_08 pPlaneCopy[2];
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With