/tags/Root-branch-php-utl/SWIG/Examples/ruby/funcptr/example.c
C | 17 lines | 12 code | 4 blank | 1 comment | 0 complexity | b885585a05bb9fcedff6a49b2eff03d1 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1/* File : example.c */
2
3int do_op(int a, int b, int (*op)(int,int)) {
4 return (*op)(a,b);
5}
6
7int add(int a, int b) {
8 return a+b;
9}
10
11int sub(int a, int b) {
12 return a-b;
13}
14
15int mul(int a, int b) {
16 return a*b;
17}