
II-294 Programming Concepts
Program on Union
16. Sizes of union and structure
void main()
{
union result
{
int marks;
char grade;
};
struct res
{
char name[15];
int age;
union result perf;
} data;
clrscr();
printf("Size of union : %d\n",sizeof(data.perf));
printf("Size of Structure : %d\n", sizeof(data));
}
OUTPUT:
Size of union : 2
Size of Structure : 19
Programs on Calling Bios and Dos Services
17. Use of REGS
#include <stdio.h>
#include <conio.h>
#include <dos.h>
void main()
{
union REGS in,out;
in.h.ah=02;
in.h.dl=89;
clrscr();
intdos(&in,&out);
}
OUTPUT:
Y
M13_ITL-ESL4791_02_SE_C13.indd 294 12/22/2012 5:06:17 PM