Thursday, February 27, 2014

Union Example

#include<stdio.h>
#include<conio.h>
main()
{
union employee
{
char name[40], add[90], ph[20];
}s;
printf("Enter your name : ");
scanf("%[^\n]s",s.name);
printf("Enter your address : ");
scanf("%s",s.add);
printf("Enter Your Phone number : ");
scanf("%s",s.ph);
printf("Hey your Phone number is : %s ",s.name);
getch();
}

No comments:

Post a Comment