source: CIVL/examples/library/pointer/symbolicPointerRealloc.cvl@ 4dec5e2

1.23 2.0 main test-branch
Last change on this file since 4dec5e2 was 58207ec, checked in by Ziqing Luo <ziqing@…>, 10 years ago

Implement bundle_unpack_apply in CIVLC-C code
add $pointer_realloc

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@3728 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 316 bytes
RevLine 
[58207ec]1#include <pointer.cvh>
2#include <stdlib.h>
3
4/* An example shows how $pointer_realloc works. */
5$input int N;
6$input int M;
7$assume(N > 4 && M > N + 2);
8int main() {
9 int * p = (int *)malloc(sizeof(int) * N);
10 int a = p[1];
11
12 $pointer_realloc(p, sizeof(int) * M);
13
14 $assert(p[1] == a);
15 free(p);
16 return 0;
17}
Note: See TracBrowser for help on using the repository browser.