source:
CIVL/examples/languageFeatures/pointerSubtractionBad2.cvl@
e7597e1
| Last change on this file since e7597e1 was 9803bc1, checked in by , 11 years ago | |
|---|---|
|
|
| File size: 340 bytes | |
| Rev | Line | |
|---|---|---|
| [b4f940a] | 1 | #include <stdlib.h> |
| 2 | #include <stddef.h> | |
| [9803bc1] | 3 | #include <civlc.cvh> |
| [b4f940a] | 4 | |
| 5 | int main(){ | |
| 6 | ptrdiff_t diff; | |
| 7 | double ** x; | |
| 8 | ||
| 9 | x = (double **)$malloc($root, sizeof(double *) * 3); | |
| 10 | for(int i=0; i<3; i++) | |
| 11 | x[i] = (double *)$malloc($root, sizeof(double) * 2); | |
| 12 | ||
| 13 | diff = x[1] - x[0]; | |
| 14 | ||
| 15 | for(int i=0; i<3; i++) | |
| 16 | $free(x[i]); | |
| 17 | $free(x); | |
| 18 | ||
| 19 | return 0; | |
| 20 | } | |
| 21 | ||
| 22 |
Note:
See TracBrowser
for help on using the repository browser.
