Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Does the enumeration type output serial numbers or characters?
Does the enumeration type output serial numbers or characters?
The elements in an enumeration variable are actually constants similar to macro definitions, such as:

Enumeration month {

January, February, March, April, May, June, July, August, September, October, November and December.

}

This is equivalent to defining:

# Definition 1 month 0

# Define Feb 1

...

# Define Dec 1 1

That is to say, if no value is assigned to the elements inside, the first element will be automatically defined as 0, and the value of each subsequent element will be the value of the previous element+1.

So these elements are all integer variables, and you can only output them as integers in% d.

Can be directly output.

printf("%d\n ",name . Zhao);

Or printf("%d\n ",j);

Because j has been assigned a value, j represents an element in name.