source:
CIVL/examples/languageFeatures/calloc.cvl@
f8f3bec
| Last change on this file since f8f3bec was 33ccc0c, checked in by , 9 years ago | |
|---|---|
|
|
| File size: 306 bytes | |
| Rev | Line | |
|---|---|---|
| [7f52ff5] | 1 | /* Commandline execution: |
| 2 | * civl verify malloc.cvl | |
| 3 | * */ | |
| 4 | #include <civlc.cvh> | |
| [33ccc0c] | 5 | #include <string.h> |
| [7f52ff5] | 6 | #include <stdlib.h> |
| 7 | ||
| 8 | void main() { | |
| 9 | double *p = calloc(5, sizeof(double)); | |
| 10 | ||
| [33ccc0c] | 11 | $assert(p[0]==0.0); |
| 12 | $assert(p[1]==0.0); | |
| 13 | $assert(p[2]==0.0); | |
| 14 | $assert(p[3]==0.0); | |
| 15 | $assert(p[4]==0.0); | |
| [7f52ff5] | 16 | $free(p); |
| 17 | } |
Note:
See TracBrowser
for help on using the repository browser.
