source:
CIVL/examples/languageFeatures/functionPointerDeref.cvl
| Last change on this file was 573de52c, checked in by , 14 months ago | |
|---|---|
|
|
| File size: 241 bytes | |
| Rev | Line | |
|---|---|---|
| [573de52c] | 1 | int f(int x) { |
| 2 | return x+10; | |
| 3 | } | |
| 4 | ||
| 5 | int main() { | |
| 6 | int (*fp)(int x); | |
| 7 | fp = &f; | |
| 8 | $print("fp = ", fp, "\n"); | |
| 9 | int a = fp(1); | |
| 10 | int b = (*fp)(1); | |
| 11 | int c = (**fp)(1); | |
| 12 | $print("a=", a, "\n"); | |
| 13 | $print("b=", b, "\n"); | |
| 14 | $print("c=", c, "\n"); | |
| 15 | } |
Note:
See TracBrowser
for help on using the repository browser.
