source: doc/rob_thesis/examples/intro/designation.c @ a1edafa

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since a1edafa was 9c14ae9, checked in by Rob Schluntz <rschlunt@…>, 7 years ago

add thesis source

  • Property mode set to 100644
File size: 400 bytes
Line 
1int printf(const char *, ...);
2
3struct A {
4  int w, x, y, z;
5};
6
7void print(struct A a) {
8        printf("{ %d, %d, %d, %d }\n", a.w, a.x, a.y, a.z);
9}
10
11int main() {
12        struct A a0 = { .x=4, .z=1, .x=8 };
13        struct A a1 = { 1, .y=7, 6 };
14        struct A a2[3] = { [2]=a0, [0]=a1, { .z=3 } };
15
16        print(a0);
17        print(a1);
18        printf("{\n");
19        for (int i = 0; i < 3; i++) {
20                printf("  ");
21                print(a2[i]);
22        }
23        printf("}\n");
24}
Note: See TracBrowser for help on using the repository browser.