17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Enumerated Types<br />

enum enumeration type: creates a list of integer constants.<br />

enum [id] { [ id [ = cexpr]] }<br />

One or more comma separated<br />

The id after enum is created as a type large enough to the<br />

largest constant in the list. The ids in the list are each created as<br />

a constant. By default the first id is set to zero and they<br />

increment by one. If a = cexpr follows an id that id will have the<br />

value of the constant expression an d the following list will<br />

increment by one.<br />

For example:<br />

enum colors{red, green=2, blue}; // red will be 0, green will be 2 and<br />

// blue will be 3<br />

SEE ALSO: Declarations, Type Specifiers, Type Qualifiers, Structures & Unions, typedef,<br />

Named Registers<br />

30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!