C
x
36
1
2
3
typedef union{4
5
struct{6
char name_main[30];7
int age;8
char color[12];9
};10
11
struct{12
char name_binary[30];13
double radius_1, radius_2;14
};15
16
struct{17
char name_light[30];18
double luminosity_low, luminosity_high, period;19
};20
21
}STARS;22
23
STARS s, *star = &s;24
25
int main()26
{27
printf("Please enter the name of the star:\n");28
scanf("%s", star->name_main);29
printf("Please enter the age of: %s\n", star->name_main);30
scanf("%d", &star->age);31
printf("Age: %d\n", star->age);32
printf("Please enter the color of: %s\n", star->name_main);33
scanf(" %s", star->color);34
printf("Color: %s\n", star->color);35
36
}$ gcc prog.c -Wall -Wextra -O2 -march=native -std=c11 -pedantic
Stdin
name42redStart
Please enter the name of the star: Please enter the age of: name Age: 42 Please enter the color of: name Color: red
0
Finish