source: CIVL/examples/languageFeatures/pointers.cvl@ 38b7d06

1.23 2.0 main test-branch
Last change on this file since 38b7d06 was 793cfc2, checked in by Tim Zirkel <zirkeltk@…>, 13 years ago

Reorganized examples and tests. Added algebra, assoc, dining, assume, and scoping examples.

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

  • Property mode set to 100644
File size: 339 bytes
Line 
1#include<civlc.h>
2
3void passByRef(int * array) {
4 *array = 42;
5}
6
7void main() {
8 int a;
9 int* b;
10 int c[2];
11 int* d;
12 int** g;
13 int* f;
14
15 f = &a;
16 a = 1;
17 b = &a;
18 c[0] = 0;
19 c[1] = 1;
20 d = &c[1];
21 g = &d;
22 $assert *b == 1;
23 $assert *d == 1;
24 $assert **g == 1;
25 $assert g == &d;
26 passByRef(f);
27 $assert *f == 42;
28}
Note: See TracBrowser for help on using the repository browser.