fork download
  1. #include <stdio.h>
  2.  
  3. int add (int a, int b) { return a + b; }
  4. int calculate (int (*p)(int, int), int a, int b) {
  5. return p(a, b);
  6. }
  7.  
  8. int main(void) {
  9. int (*p) (int, int);
  10.  
  11. p = add;
  12.  
  13. printf("Result: %d", calculate(p, 2, 3));
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Result: 5