Image

Programs - C Language - Struc, ENUM, Union

Program:

#include<stdio.h>
#include<conio.h>
void main(){
enum month{
  jan,feb,mar,apr,may,jun,jul
 };

typedef enum month m;

 m m1,m2;

 clrscr();

 m1=mar;
printf("m1 = %d\n",m1);
printf("Enter value for m2: ");
scanf("%d",&m2);

printf("m2 = %d\n",m2);

 getch();
}