Commit | Line | Data |
---|---|---|
3cd4b0f8 MW |
1 | /* designated initializers of various kinds */ |
2 | ||
3 | struct foo { | |
4 | int a; | |
5 | int b; | |
6 | struct { | |
7 | int c; | |
8 | int d; | |
9 | } e; | |
10 | }; | |
11 | ||
12 | struct foo x = { | |
13 | .e.d = 1, | |
14 | .e.c = 1, | |
15 | .b = 2, | |
16 | .a = 3 | |
17 | }; | |
18 | ||
19 | int array[10] = { | |
20 | [0] = 1, | |
21 | [1] = 2, | |
22 | [2] = 3 | |
23 | }; | |
24 | ||
25 | /* GCC designators */ | |
26 | ||
27 | int gcc_array[10] = { | |
28 | [0] 1, | |
29 | [1] 2, | |
30 | [2] 3 | |
31 | }; | |
32 | ||
33 | struct foo gcc_f = { | |
34 | a: 1, | |
35 | b: 2 | |
36 | }; |