source:
CIVL/examples/languageFeatures/forall2.cvl
| Last change on this file was d24f3f3, checked in by , 9 months ago | |
|---|---|
|
|
| File size: 280 bytes | |
| Line | |
|---|---|
| 1 | #include <stdlib.h> |
| 2 | |
| 3 | typedef struct M { |
| 4 | int f; |
| 5 | } *B; |
| 6 | |
| 7 | int main() { |
| 8 | int n = 2; |
| 9 | B x[2]; |
| 10 | for (int i = 0; i < n; i++) { |
| 11 | x[i] = (B)malloc(sizeof(struct M)); |
| 12 | x[i]->f = 4; |
| 13 | } |
| 14 | $assert($forall(int i : 0 .. n - 1) x[i]->f == 4); |
| 15 | $for(int i: 0 .. n-1) |
| 16 | free(x[i]); |
| 17 | } |
Note:
See TracBrowser
for help on using the repository browser.
