SHARE
TWEET

Example of passing a function pointer to another function

a guest Jan 26th, 2013 2,150 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. void affirm(void) {
  4.     printf("It's true.\n");
  5. }
  6.  
  7. void state(void fn(void)) {
  8.     printf("You can pass function pointers with a simple syntax.\n");
  9.     fn();
  10. }
  11.  
  12. int main(void) {
  13.     state(affirm);
  14.     return 0;
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top