Create a union containing 6 strings: name, home_address, hostel_address, city, state and zip. Write a C program to display your present address.
Program Code:
#include<stdio.h>
#include<string.h>
union details
{
char name[20];
char home_add[30];
char hostel_add[30];
char city[10];
char state[10];
int pincode;
}a;
void main()
{
strcpy(a.name,"rama");
printf("\n %s",a.name);
strcpy(a.home_add,"1-83/10,jublie hills");
printf("\n %s",a.home_add);
strcpy(a.hostel_add,"iare college");
printf("\n %s",a.hostel_add);
strcpy(a.city,"hyderabad");
printf("\n %s",a.city);
strcpy(a.state,"telangana");
printf("\n %s",a.state);
a.pincode=500043;
printf("\n %d",a.pincode);
getch();
}
LOTS OF ERROES
ReplyDeletelots of error
ReplyDelete