source:
CIVL/examples/languageFeatures/pointerAddBad2.cvl
| Last change on this file was ea777aa, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 364 bytes | |
| Rev | Line | |
|---|---|---|
| [e6b02c8] | 1 | #include <civlc.cvh> |
| [d010d61] | 2 | #include <stdio.h> |
| [e6b02c8] | 3 | |
| [d66b03b] | 4 | $scope root = $here; |
| 5 | ||
| [d010d61] | 6 | void main(){ |
| 7 | ||
| 8 | int **p; | |
| 9 | int ret; | |
| 10 | ||
| [d66b03b] | 11 | p = (int **)$malloc(root, sizeof(int *) * 10); |
| [d010d61] | 12 | for(int i=0; i<10; i++){ |
| [d66b03b] | 13 | p[i] = (int *)$malloc(root, sizeof(int) * 10); |
| [d010d61] | 14 | for(int j = 0; j<10; j++) |
| 15 | p[i][j] = i; | |
| 16 | } | |
| 17 | ||
| 18 | ret = *(&p[0][0] + 10); | |
| [0c8fec8] | 19 | for(int i=0; i<10; i++) |
| 20 | $free(p[i]); | |
| [d010d61] | 21 | $free(p); |
| 22 | } |
Note:
See TracBrowser
for help on using the repository browser.
