Simple Union

Thursday, 8 September 2011

#include<stdio.h>
#include<conio.h>


union person
  {
   int id;
   char sex;
  };


void main()
{
union person p;
clrscr();
p.id=12;
p.sex='m';
printf("Id is %d\n",p.id);
printf("Sex is %c\n",p.sex);
getch();
}


OUTPUT:


Id is 109
Sex is m







No comments:

Post a Comment

 

Blogger news

Blogroll

Enter your email address:

Delivered by FeedBurner

Total Pageviews

Followers

Most Reading