Enumerations Flashcards

1
Q

Enumerated Type

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Enumeration Constant

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Declaring an Enumeration

A

typedef enum

{name, next_name}

enum_name;

(inside of a function)

enum_name enum_kind;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Using an Enumaration

A

Value of enumeration kind is the name of enumeration.

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Enumerated Type Definition

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What kind of operators can be used with enumerated types?

A

Relational, assignment, and arithmetic.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly