source: CIVL/examples/languageFeatures/pointerAddBad2.cvl@ b67507f

1.23 2.0 main test-branch
Last change on this file since b67507f was 0c8fec8, checked in by Ziqing Luo <ziqing@…>, 12 years ago

Add $free statements for memory units

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

  • Property mode set to 100644
File size: 341 bytes
Line 
1#include <civlc.h>
2#include <stdio.h>
3void main(){
4
5 int **p;
6 int ret;
7
8 p = (int **)$malloc($root, sizeof(int *) * 10);
9 for(int i=0; i<10; i++){
10 p[i] = (int *)$malloc($root, sizeof(int) * 10);
11 for(int j = 0; j<10; j++)
12 p[i][j] = i;
13 }
14
15 ret = *(&p[0][0] + 10);
16 for(int i=0; i<10; i++)
17 $free(p[i]);
18 $free(p);
19}
Note: See TracBrowser for help on using the repository browser.