source:
CIVL/examples/languageFeatures/mallocBad2.cvl@
90dd7d7
| Last change on this file since 90dd7d7 was 1f192b0, checked in by , 13 years ago | |
|---|---|
|
|
| File size: 197 bytes | |
| Line | |
|---|---|
| 1 | #include <civlc.h> |
| 2 | |
| 3 | // Uses pointer with no malloc. |
| 4 | void main() { |
| 5 | $heap h; |
| 6 | double *p; // = (double *) $malloc(&h, 5*sizeof(double)); |
| 7 | |
| 8 | p[4]=3.14; |
| 9 | $assert(p[4]==3.14); |
| 10 | $free(&h, p); |
| 11 | } |
Note:
See TracBrowser
for help on using the repository browser.
