source:
CIVL/examples/languageFeatures/structArray.cvl@
90dd7d7
| Last change on this file since 90dd7d7 was 4eccc907, checked in by , 13 years ago | |
|---|---|
|
|
| File size: 260 bytes | |
| Line | |
|---|---|
| 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.
