fork download
  1. #include <stdio.h>
  2.  
  3. int bounce(int a);
  4. int caller (int(*function)(int), int b);
  5.  
  6. int main() {
  7. int num;
  8. int (*fptr) (int)=bounce;
  9.  
  10. num=(*fptr) (10);
  11. printf("Returned value: %d \n", num);
  12.  
  13. num=caller(fptr, 5);
  14. printf("Returned value; %d \n", num);
  15.  
  16. return 0;
  17. }
  18.  
  19. int bounce(int a) {
  20. printf("\n Received value: %d \n", a);
  21. return ((3 * a) + 3);
  22. }
  23.  
  24. int caller(int(*function)(int), int b) {
  25. function(b);
  26. }
  27.  
Success #stdin #stdout 0s 4340KB
stdin
Standard input is empty
stdout
 Received value: 10 
Returned value: 33 

 Received value: 5 
Returned value; 0