hi,
I was wondering if it was possible to use multiple enums that are subsets of eachother. This next example is syntactically incorrect, but it's what I do want to acheave:
typedef enum one
{
A,
B,
C,
D
}
typedef enum two
{
C,
D,
E
}
and also,
is it possible to re-use any of the enum elements as variables, but still retaining its meaning, being part of an enum.
like:
No. Enums are not "full" types, which is annoying, which means that
1 2 3 4 5 6 7 8 9
enum RedThings {
Apple,
Tomato
};
enum Fruit {
Orange,
Apple
};
declares the symbol "Apple" twice, the first time with value 0 and the second with value 1. Symbols declared "inside" enums are not scoped within the enum. That is, you don't refer to Fruit::Apple, but rather just Apple.