PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/octave/funcptr2/example.c

#
C | 19 lines | 13 code | 5 blank | 1 comment | 0 complexity | 0c336cdbc137b3627c8c9db36800c453 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* File : example.c */
  2. int do_op(int a, int b, int (*op)(int,int)) {
  3. return (*op)(a,b);
  4. }
  5. int add(int a, int b) {
  6. return a+b;
  7. }
  8. int sub(int a, int b) {
  9. return a-b;
  10. }
  11. int mul(int a, int b) {
  12. return a*b;
  13. }
  14. int (*funcvar)(int,int) = add;