fork download
  1. #include <stdio.h>
  2.  
  3. typedef void(*callback)(int);
  4.  
  5. void callBackTester (int min, int max, callback func);
  6.  
  7. void my_function(int);
  8.  
  9. int main(void)
  10. {
  11. callBackTester(0,10,&my_function);
  12. return 0;
  13. }
  14.  
  15.  
  16. void callBackTester (int min, int max, callback func)
  17. {
  18. for(; min < max; ++min){
  19. func(min);
  20. }
  21. }
  22.  
  23. void my_function(int value)
  24. {
  25. printf("value: %08d\n",value);
  26. }
Success #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
value: 00000000
value: 00000001
value: 00000002
value: 00000003
value: 00000004
value: 00000005
value: 00000006
value: 00000007
value: 00000008
value: 00000009