source:
CIVL/examples/library/civlc/bundleAndHeap.cvl@
ecfe5bf
| Last change on this file since ecfe5bf was a4a8ef7, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 294 bytes | |
| Rev | Line | |
|---|---|---|
| [a4a8ef7] | 1 | #include <civlc.cvh> |
| 2 | #include <bundle.cvh> | |
| 3 | ||
| 4 | $input int N; | |
| 5 | $assume N > 2; | |
| 6 | $input int a[N]; | |
| 7 | ||
| 8 | int main(){ | |
| 9 | int * b; | |
| 10 | $bundle bun; | |
| 11 | ||
| 12 | b = (int *)$malloc($root, N * sizeof(int)); | |
| 13 | bun = $bundle_pack(a, sizeof(int) * N); | |
| 14 | $bundle_unpack(bun, b); | |
| 15 | $assert b[0] == a[0]; | |
| 16 | $free(b); | |
| 17 | return 0; | |
| 18 | } |
Note:
See TracBrowser
for help on using the repository browser.
