source:
CIVL/examples/languageFeatures/pointerAddBad2.cvl@
ca6241a
| Last change on this file since ca6241a was e6b02c8, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 344 bytes | |
| Rev | Line | |
|---|---|---|
| [e6b02c8] | 1 | #include <civlc.cvh> |
| [d010d61] | 2 | #include <stdio.h> |
| [e6b02c8] | 3 | |
| [d010d61] | 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); | |
| [0c8fec8] | 17 | for(int i=0; i<10; i++) |
| 18 | $free(p[i]); | |
| [d010d61] | 19 | $free(p); |
| 20 | } |
Note:
See TracBrowser
for help on using the repository browser.
