Can someone please explain to me which part is what in this:
enum bb { cc } dd;
I understand that enum bb is the name of the enumeration and that { cc } is its enumerator, but I have no clue what dd is.
enum bb
{
cc
} dd;
bb - enum tag.cc - enumerator constant. As it is first and it does not have an expicity defined value it will be zero (0);dd - variable of type enum bbIt can be written as:
enum bb
{
cc
};
enum bb dd;
It defines dd as a variable of the type enum bb. Take a look at Enumerations
It behaves just like when you're defining normally
#include <stdio.h>
int main()
{
enum bb { cc, ee } dd = cc; // dd is now 0
dd = ee; // dd is now 1
printf("%d", dd);
}
Link.