source:
CIVL/examples/por/pointerShare2.cvl@
8991bd6
| Last change on this file since 8991bd6 was dc5e75d, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 267 bytes | |
| Rev | Line | |
|---|---|---|
| [2e23cba] | 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() { | |
| [48bfab9] | 15 | $proc fp; |
| 16 | ||
| [78fdaf0] | 17 | x = (int*) $malloc($root, sizeof(int)); |
| [2e23cba] | 18 | p = x; |
| 19 | *x = 0; | |
| [48bfab9] | 20 | fp = $spawn f(); |
| [2e23cba] | 21 | $assert(*p==0); |
| [48bfab9] | 22 | $wait(fp); |
| [dc5e75d] | 23 | $free(x); |
| [2e23cba] | 24 | } |
Note:
See TracBrowser
for help on using the repository browser.
