Anonymous enums are the enum in C/C++ that we can access its elements without declaring an enum variable
#include <iostream>
using namespace std;
int main()
{
enum weekday{mon,tue,wed, thus,fri,sat,sun};
cout << "day=" <<sat<< endl;//with out using declaration enum weekday; we can access its elements
return 0;
}
Output
day=5
Leave a Reply