ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
with_gc
|
Last change
on this file since c916e12 was 9c14ae9, checked in by Rob Schluntz <rschlunt@…>, 9 years ago |
|
add thesis source
|
-
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.