1.23
2.0
main
test-branch
|
Last change
on this file since 9179b4f was 40a899c, checked in by Tim Zirkel <zirkeltk@…>, 13 years ago |
|
Fixed pass by reference for pointers. Fixed bug (?) caused by arriving at a wait before a process had spawned. Maybe this should be logged as an error? Fixed several other exceptions. Updated pointers example. Added compare example to illustrate defect with comparing real and int.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@84 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
339 bytes
|
| Line | |
|---|
| 1 | #include<civlc.h>
|
|---|
| 2 |
|
|---|
| 3 | void passByRef(int * array) {
|
|---|
| 4 | *array = 42;
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | void 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.