Structure and Union II-293
14. Program to display information of an employee
#include <stdio.h>
#include <conio.h>
void main()
{
typedef struct
{
char name[20];
char sex[2];
int acno;
} info;
info empo={"Sanjay","M",1452};
clrscr();
printf("
%s %s %d", empo.name, empo.sex, empo.acno);
}
OUTPUT:
Sanjay M 1452
Programs on Enumerated Data Type
15. Program to display the values of some months with enum data
#include <stdio.h>
#include <conio.h>
void main()
{
enum {Jan,Feb,March,Apr,May};
clrscr();
printf("Jan=%d",Jan);
printf("
Feb=%d",Feb);
}
OUTPUT:
Jan=0 Feb=1
M13_ITL-ESL4791_02_SE_C13.indd 293 12/22/2012 5:06:16 PM