fork download
  1. //this was taken from http://www.cprogramming.com/tutorial/function-pointers.html
  2. #include <stdio.h>
  3. void my_int_func(int x)
  4. {
  5. printf( "%d\n", x );
  6. }
  7.  
  8.  
  9. int main()
  10. {
  11. void (*foo)(int); //pointer to an int function
  12. foo = *my_int_func;
  13.  
  14. /* call my_int_func (note that you do not need to write (*foo)(2) ) */
  15. foo( 2 );
  16. /* but if you want to, you may */
  17. (*foo)( 2 );
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0.02s 2680KB
stdin
Standard input is empty
stdout
2
2