Sunday, August 21, 2011

Program to show the concept of union.

//Program to show the concept of union.
#include<stdio.h>
#include<conio.h>
void main()
{
union student
{
 char g;
 int r;
 float m;
 double f;
}s;
clrscr();
printf("size of union %d",sizeof(s));
printf("\n enter the grade");
s.g=getche();
printf("\n the grade %c",s.g);
printf("\n enter the rollno");
scanf("%d",&s.r);
printf("\n the rollno %d" ,s.r);
printf("\n enter the marks");
scanf("%f",&s.m);
printf("\n the marks %f",s.m);
printf("\n enter the fee");
scanf("%lf",&s.f);
printf("\n the fee %lf",s.f);
getch();
}

Previous Next Home
1 Comments
Comments

Good Work :)
You Will Rock :)

Leave a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Twitter Delicious Facebook Favorites More