aboutsummaryrefslogtreecommitdiff
path: root/compile_data/custom_struct4.c
blob: 75f50ea0408577a13b11cad44a77be25b8d5c9bb (plain) (blame)
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
struct A {
    struct B {
        int x, y;
        struct C {
            int w;
        } c;
    } b;
    int z;
};

struct B f(struct A a) {
    printf("z: %d\n", a.z);
    return a.b;
}

struct C g(struct B b) {
    printf("x: %d\ny: %d\n", b.x, b.y);
    return b.c;
}

int main() {
    struct A a;
    a.z = 1;
    a.b.x = 2;
    a.b.y = 3;
    a.b.c.w = 4;
    printf("w: %d\n", g(f(a)).w);
}