write a program to store the information of student by using union.
#include<stdio.h>
#include<conio.h>
union student
{
char name[10];
int rollno;
};
main()
{
union student stu;
printf("enter student name\n");
scanf("%s",&stu.name);
printf("student name is %s\n",stu.name);
printf("enter student rollno\n");
scanf("%d",&stu.rollno);
printf("student rollno is %d\n",stu.rollno);
return 0;
}
Comments
Post a Comment