Wednesday, 5 December 2012

CPL PROGRAM 14c CODING

              PROGRAM USING UNIONS
                                                      
CODING:                                                           
                                                                                                           
#include<stdio.h>
#include<conio.h>
union student
{
 int rollno;
 char grade;
 float percent;
 double average;
}b;
void main()
{
 clrscr();
 printf("Enter the Integer value ");
 scanf("%d",&b.rollno);
 printf("Enter the Character value ");
 scanf("%c",&b.grade);
 printf("Enter the Float value ");
 scanf("%f",&b.percent);
 printf("Enter the Double value ");
 scanf("%f",&b.average);
 printf("size of union =%d",sizeof(b));
 getch();
}

No comments:

Post a Comment