About learning c struct

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
#include <stdio.h>
struct first{
char name[10];
};
struct second{
struct first a;
int x;
};
struct third{
struct second b;
struct first c;
char y[5];
};


int main(){
struct third d = {.b = {.x = 233,.a = {"huaji"}},
.c = {"huaihuai"},"2333"};
struct third * p;
p = &d;
printf("%s\n",p -> b.a.name);
printf("%d\n",p -> b.x);
printf("%s\n",p -> y);
printf("%s\n",d.b.a.name);

struct second * z;
z = &d.b;
printf("%s\n",z -> a.name);
printf("%d\n",z -> x);

struct first * m;
m = &d.b.a;
printf("%s\n",m -> name);
return 0;
}