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