recent

C Program Of Union

C Program Of Union

#include<stdio.h>

union student
{
int roll;
char name[20];
}st;

main()
{

printf("Enter Roll no.:\n");
scanf("%d",&st.roll);

printf("Enter name:\n");
scanf("%s",st.name);

printf("%d\n%s\n",st.roll,st.name);

printf("Enter name:\n");
scanf("%s",st.name);

printf("%d\n%s\n",st.roll,st.name);

}
Powered by Blogger.