Pages

Enumeration

Introduction 
                        The enumerated data type is used when we know in advance about a finite list of values as a particular data type .the declaration of enumerated  data type and start with enum key word . the list of values is know as the enumerated list of item

Syntax
            enum <enum name >  { value 1,value2,value 3 };

Eg
            enum color {red ,blue ,green , white ,black};

Program

#include<stdio.h>
#include<conio.h>
enum color{red ,green , black ,white};
{

void main ( )
{
clrscr();
printf("\n the value of red =%d",red);
printf("\n the value of green =%d",green);

printf("\n the value of white =%d",white);
}

0 comments: