For example:
enum ABC
{
apple = 0xe,
banana = 0xd,
orange,
pineapple
}
Can orange automatically get the value of 0xc and pineapple 0xb?
No, the values can only automatically increment. If you want the values to go the other way then you can reverse the order of the names.
enum ABC
{
pineapple = 0xb,
orange,
banana,
apple
};
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