PageRenderTime 25ms CodeModel.GetById 21ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/ruby/funcptr2/example.c

#
C | 19 lines | 13 code | 5 blank | 1 comment | 0 complexity | 0c336cdbc137b3627c8c9db36800c453 MD5 | raw file
 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}
18
19int (*funcvar)(int,int) = add;