Create Enumerations - C Data Type

C examples for Data Type:enum

Introduction

With an enumeration, you define a new integer type where variables of the type have a fixed range of possible values.

Here's an example of a statement that defines an enumeration type with the name Weekday:

Demo Code

#include <stdio.h> 
  
int main(void) 
{ 
    enum Weekday {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};  
    /*from  w  w  w .  j  av a2s.c  o m*/
    printf("Weekday created");
    return 0; 
}

Result


Related Tutorials