#include <stdio.h>
#include <memory.h>
#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, 0, 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 %s 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("\n%s 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;
}