1 | #include <stdio.h> |
2 | |
3 | struct CG {int x; int y;}; |
4 | |
5 | int g(int (^callback)(struct CG)) { |
6 | struct CG cg = {.x=1,.y=2}; |
7 | |
8 | int z = callback(cg); // Set breakpoint 2 here. |
9 | |
10 | return z; |
11 | } |
12 | |
13 | int h(struct CG cg){return 42;} |
14 | |
15 | int main() |
16 | { |
17 | int c = 1; |
18 | |
19 | int (^add)(int, int) = ^int(int a, int b) |
20 | { |
21 | return a + b + c; // Set breakpoint 0 here. |
22 | }; |
23 | |
24 | int (^neg)(int) = ^int(int a) |
25 | { |
26 | return -a; |
27 | }; |
28 | |
29 | printf(format: "%d\n" , add(3, 4)); |
30 | printf(format: "%d\n" , neg(-5)); // Set breakpoint 1 here. |
31 | |
32 | int (^add_struct)(struct CG) = ^int(struct CG cg) |
33 | { |
34 | return cg.x + cg.y; |
35 | }; |
36 | |
37 | g(callback: add_struct); |
38 | |
39 | return 0; |
40 | } |
41 | |