-
Notifications
You must be signed in to change notification settings - Fork 0
/
struct.c
52 lines (42 loc) · 1.23 KB
/
struct.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <stdio.h>
struct personal {
char name[100];
char address[200];
int age;
float weigh;
};
int main() {
struct personal minhkma;
strcpy(minhkma.name, "Nguyen Van Minh");
strcpy(minhkma.address, "Dong Hung, Thai Binh");
minhkma.age = 22;
minhkma.weigh = 59.58;
printf("-------------------------------\n");
printf("Name: %s\n", minhkma.name);
printf("Address: %s\n", minhkma.address);
printf("Age: %d\n", minhkma.age);
printf("Weigh: %.2f\n", minhkma.weigh);
struct personal poisonous;
strcpy(poisonous.name, "Chang Yeu Ai");
strcpy(poisonous.address, "Dong Hung, Thai Binh");
poisonous.age = 17;
poisonous.weigh = 45.5;
printf("-------------------------------\n");
printf("Name: %s\n", poisonous.name);
printf("Address: %s\n", poisonous.address);
printf("Age: %d\n", poisonous.age);
printf("Weigh: %.2f\n", poisonous.weigh);
printf("-------------------------------\n");
}
//output
//-------------------------------
//Name: Nguyen Van Minh
//Address: Dong Hung, Thai Binh
//Age: 22
//Weigh: 59.58
//-------------------------------
//Name: Chang Yeu Ai
//Address: Dong Hung, Thai Binh
//Age: 17
//Weigh: 45.50
//-------------------------------