From 52b29440f8f1310e0c074c8eb409e433c56bdd62 Mon Sep 17 00:00:00 2001 From: Teddy Date: Wed, 7 May 2014 03:17:32 +0800 Subject: rename --- compile_data/custom_struct4.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 compile_data/custom_struct4.c (limited to 'compile_data/custom_struct4.c') diff --git a/compile_data/custom_struct4.c b/compile_data/custom_struct4.c new file mode 100644 index 0000000..75f50ea --- /dev/null +++ b/compile_data/custom_struct4.c @@ -0,0 +1,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); +} -- cgit v1.2.3-70-g09d2