Write a Program in C to demonstrate enum.

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
enum y {a,b,c,d,e,f,g,h,i,j,k};
clrscr();
printf("The values for the declared variables are:\n ");
for(i=a;i<=k;i++)
     printf("\n%d",i);
getch();
}

Output :- 

The values for the declared variables are:

0
1
2
3
4
5
6
7
8
9
10

No comments:

Post a Comment