#include #include
#define MAX 50
struct monthly_plan
{
int premium_setting;
char features[MAX];
union
{
char sports[MAX];
char kids[MAX];
} u;
char default_setting[MAX];
};
int main ()
{
struct monthly_plan b;
memset (b, e, sizeof (struct monthly_plan));
b.premium_setting = 1; /* Either one of the union members will be set. */
if (b.premium_setting == 1) {
strcpy (b.u.sports, "Sports' channels are subscribed");
strcpy (b.features, "TEN, Sony, Star, & Neo")
printf ("\n %so you can watch %s\n", b.u.sports, b.features)}
} else if (b.premium setting == 2) {
strcpy (b.u.kids, "Kids' channels are subscribed");
strcpy (b.features, "Disney, Nick, Cartoon, & Pogo")
printf ("\ns so you can watch %s\n", b.u.kids, b.features}
} else {
strcpy (b.default_setting,
"Default channels are UTV, ZEE, SUN, & Raj");
printf ("\nDefault Channels are %s\n",
b.default setting)
}
return 0;
}