source:
CIVL/examples/por/pointerShare2.cvl@
6a436f4
| Last change on this file since 6a436f4 was dc5e75d, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 267 bytes | |
| Line | |
|---|---|
| 1 | #include<civlc.h> |
| 2 | int *x; |
| 3 | int *p; |
| 4 | |
| 5 | void f() { |
| 6 | int y=0; |
| 7 | { |
| 8 | int *q = p; |
| 9 | y = y + 1; |
| 10 | *q = 15; |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | void main() { |
| 15 | $proc fp; |
| 16 | |
| 17 | x = (int*) $malloc($root, sizeof(int)); |
| 18 | p = x; |
| 19 | *x = 0; |
| 20 | fp = $spawn f(); |
| 21 | $assert(*p==0); |
| 22 | $wait(fp); |
| 23 | $free(x); |
| 24 | } |
Note:
See TracBrowser
for help on using the repository browser.
