source:
CIVL/examples/por/pointerShare2.cvl@
be4355b
| Last change on this file since be4355b was 0b9a80a, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 222 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() { | |
| [78fdaf0] | 15 | x = (int*) $malloc($root, sizeof(int)); |
| [2e23cba] | 16 | p = x; |
| 17 | *x = 0; | |
| 18 | $spawn f(); | |
| 19 | $assert(*p==0); | |
| 20 | } |
Note:
See TracBrowser
for help on using the repository browser.
