source: CIVL/examples/languageFeatures/pointerAddBad2.cvl@ 085533f

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

new pointerAdd () function and couple of examples

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

  • Property mode set to 100644
File size: 299 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 $free(p);
17}
Note: See TracBrowser for help on using the repository browser.