main
| Rev | Line | |
|---|
| [aad342c] | 1 | /* completeStruct.c: example where a structure is first declared
|
|---|
| 2 | * in an incomplete state, then a typdef is made to that type,
|
|---|
| 3 | * then the structure is completed, then the typedef is used.
|
|---|
| 4 | * The use should work because the typedef is like a reference to
|
|---|
| 5 | * the type which was completed.
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | struct foo;
|
|---|
| 9 | typedef struct foo Foo;
|
|---|
| 10 | struct foo {int x;};
|
|---|
| 11 | int main() {
|
|---|
| 12 | Foo f;
|
|---|
| 13 | f.x = 1;
|
|---|
| 14 | return f.x;
|
|---|
| 15 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.