Enumeration (enum)
Enumeration, also known as enum is a user-defined data type that is used to assign some name to the integral constant. By default, the enum members are assigned values starting from 0 but we can also assign values manually.
Syntax of enum
enum { name1, name2, name3 = value };
Example of enum
C
// An example program to demonstrate working // of enum in C #include <stdio.h> enum week { Mon, Tue, Wed, Thur, Fri, Sat, Sun }; int main() { enum week day; day = Wed; printf ( "%d" , day); return 0; } |
2
C Cheat Sheet
This C Cheat Sheet provides an overview of both basic and advanced concepts of the C language. Whether you’re a beginner or an experienced programmer, this cheat sheet will help you revise and quickly go through the core principles of the C language.
In this Cheat Sheet, we will delve into the basics of the C language, exploring its fundamental concepts that lay the groundwork for programming. We will cover topics such as variables, data types, and operators, providing you with a solid understanding of the building blocks of C programming.
Contact Us