0Pricing
C Academy · Lesson

Enumerations (enum)

Discover how enumerations improve code readability and efficiency.

1

Enumerations in C

An enumeration (enum) is a user-defined data type that assigns names to a set of integer values.

In this lesson, you will learn:

  • How to define and use enumerations.
  • How enum improves code readability.
  • How to assign custom values to enumeration constants.
Enumerations (enum) — illustration 1

2

What is an Enumeration?

Enumerations assign names to a set of integer constants.

Example declaration:

enum Color {RED, GREEN, BLUE};

By default, RED is 0, GREEN is 1, and BLUE is 2.

All lessons in this course

  1. Defining and Using Structures
  2. Unions and Memory Efficiency
  3. Enumerations (enum)
← Back to C Academy