fork download
  1. #include <stdio.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. int sum (int x, int y) {
  6. return x + y;
  7. }
  8. int product (int x, int y) {
  9. return x * y;
  10. }
  11. int execute(int(* op)(int, int), int x, int y) {
  12. return op(x, y);
  13. }
  14. int main(void) {
  15. int x = 6;
  16. int y = 7;
  17. printf("Sum: %d \n", execute(sum, x, y));
  18. printf("Product: %d \n", execute(product, x, y));
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
Sum: 13 
Product: 42