source:
CIVL/examples/languageFeatures/malloc2d.cvl@
90dd7d7
| Last change on this file since 90dd7d7 was 8fa5a7b, checked in by , 13 years ago | |
|---|---|
|
|
| File size: 263 bytes | |
| Rev | Line | |
|---|---|---|
| [8fa5a7b] | 1 | #include <civlc.h> |
| 2 | #define N 5; | |
| 3 | #define M 8; | |
| 4 | ||
| 5 | void main() { | |
| 6 | $heap h; | |
| 7 | double **p = (double **) $malloc(&h, N*sizeof(double *)); | |
| 8 | ||
| 9 | for (int i = 0; i < M; i++) { | |
| 10 | p[i] = (double *) $malloc(&h | |
| 11 | } | |
| 12 | ||
| 13 | p[4]=3.14; | |
| 14 | $assert(p[4]==3.14); | |
| 15 | $free(&h, p); | |
| 16 | } |
Note:
See TracBrowser
for help on using the repository browser.
