Enumeration in C language.

Enumeration in C language.

Learn from voice....

17/01/2021 7:33AM

Episode Synopsis "Enumeration in C language."

Enumeration in C language. Enumerated types are a special way of creating our own type in C. The type is a "list of key words". Enumerated types are used to make a program clearer to the reader/maintainer of the program. Enumerated Types allow us to create our own symbolic names for a list of related ideas. The key word for an enumerated type is enum. For example, we can create an enumerated type for true and false. We can also create an enumerated type to represent various security levels so that our program can run a door card reader. These enumerated types can be used like any other type in a program. In Essence, Enumerated types provide a symbolic name to represent one state out of a list of states. Even though enumerated type values look like strings, they are new key words that we define for our program. Once defined the computer can process them directly. There is no need to use strcmp with enumerated types. It turns out that enumerated types are treated like integers by the compiler. Underneath they have numbers 0,1,2,... etc. We should never rely on this fact, but it does come in handy for certain applications.

Listen "Enumeration in C language."

More episodes of the podcast Learn from voice....