Enumerations Flashcards Preview

CSCI 220 > Enumerations > Flashcards

Flashcards in Enumerations Deck (6):
1

Enumerated Type

A data type whose list of values is specified by the programmer in a type declaration

2

Enumeration Constant

An identifier that is one of the values of an enumerated type

3

Declaring an Enumeration

typedef enum

{name, next_name}

enum_name;

(inside of a function)

enum_name enum_kind;

4

Using an Enumaration

Value of enumeration kind is the name of enumeration.

Assign an integer value to &enum_kind to get name of enumeration.

5

Enumerated Type Definition

Syntax:

typedef enum

{identifier_list}

enum_type;

Interpretation:

A new data type named enum_ type is defined. The valid values of this type are the identifiers of identifier_ list . The first identifier is represented by the integer 0, the second by the integer 1, and so on. A particular identifier can appear in only one identifier_ list in a given scope.

6

What kind of operators can be used with enumerated types?

Relational, assignment, and arithmetic.