source:
CIVL/mods/dev.civl.com/examples/library/stdlib/calloc3.cvl@
e49edeb
| Last change on this file since e49edeb was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 329 bytes | |
| Line | |
|---|---|
| 1 | /* Commandline execution: |
| 2 | * civl verify malloc.cvl |
| 3 | * */ |
| 4 | #include <civlc.cvh> |
| 5 | #include <string.h> |
| 6 | #include <stdlib.h> |
| 7 | |
| 8 | void main() { |
| 9 | int *p; |
| 10 | int *q; |
| 11 | |
| 12 | *p = 1; |
| 13 | p = (p != NULL) ? p : calloc(1, sizeof(int)); |
| 14 | q = (p != NULL) ? p : (int*)calloc(1, sizeof(int)); |
| 15 | |
| 16 | $assert(*p==1 && *q==1); |
| 17 | $free(p); |
| 18 | $free(q); |
| 19 | } |
Note:
See TracBrowser
for help on using the repository browser.
