ADT
ast-experimental
enum
pthread-emulation
qualifiedEnum
|
Last change
on this file since 04821de was 67982887, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago |
|
specialize thesis directory-names
|
-
Property mode
set to
100644
|
|
File size:
400 bytes
|
| Line | |
|---|
| 1 | int printf(const char *, ...);
|
|---|
| 2 |
|
|---|
| 3 | struct A {
|
|---|
| 4 | int w, x, y, z;
|
|---|
| 5 | };
|
|---|
| 6 |
|
|---|
| 7 | void print(struct A a) {
|
|---|
| 8 | printf("{ %d, %d, %d, %d }\n", a.w, a.x, a.y, a.z);
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | int 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.