source: doc/theses/rob_schluntz/examples/intro/designation.c @ f184ca3

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumwith_gc
Last change on this file since f184ca3 was 728df66, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

more documentation name changes

  • 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.