Issue with typedef enum

In your code:1, you didn’t mention data type of the enumeration. So it will be considered as an “int” data type. int is the default data type of enumeration in the absence of a data type declaration.

int is a 2-state data type whose default value will be 0. On incrementing, it is displayed as 1.

Coming to the code:2, Data type of the enumeration is declared as integer whose default value would be 'x. Hence all x’s in your output