English
Language : 

CC78K0S Datasheet, PDF (59/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 3 DECLARATION OF TYPES AND STORAGE CLASSES
3.2.2 Enumeration specifiers
An enumeration type specifier indicates a list of objects to be put in sequence. Objects to be declared with the
enum specifier will be declared as constants that have int types.
The enumeration specifier is declared as shown below.
enum identifier {enumerator list}
Objects are declared with an enumerator list. Values are defined for all objects in the list in the order of their
declaration by assigning the value of 0 to the first object and the value of the previous object plus 1 to the 2nd and
subsequent objects. A constant value may also be specified with “=”.
In the following example, “hue” is assumed as the tag name of the enumeration, “col” as an object that has this
(enum) type, and “cp” as a pointer to an object of this type. In this declaration, the values of the enumeration
become “{0, 1, 20, 21}”.
enum hue{
chartreuse,
burgundy,
claret=20,
winedark
};
enum hue col,*cp;
void main(void) {
col=claret;
cp=&col ;
/*...*/ (*cp!=burgundy) /*...*/
.
.
.
User’s Manual U14872EJ1V0UM
59