source:
CIVL/examples/languageFeatures/structArray.cvl@
38b7d06
| Last change on this file since 38b7d06 was 4eccc907, checked in by , 13 years ago | |
|---|---|
|
|
| File size: 260 bytes | |
| Rev | Line | |
|---|---|---|
| [4eccc907] | 1 | #include <civlc.h> |
| 2 | ||
| 3 | typedef struct foo { | |
| 4 | int* a; | |
| 5 | } foo; | |
| 6 | ||
| 7 | void main() { | |
| 8 | foo bar[2]; | |
| 9 | int baz[3]; | |
| 10 | ||
| 11 | for (int i = 0; i < 3; i++) { | |
| 12 | baz[i] = i; | |
| 13 | } | |
| 14 | ||
| 15 | bar[0].a = baz; | |
| 16 | bar[1].a = &baz[1]; | |
| 17 | ||
| 18 | $assert bar[0].a[0] == 0; | |
| 19 | $assert bar[1].a[0] == 1; | |
| 20 | } |
Note:
See TracBrowser
for help on using the repository browser.
