Advertisement
Guest User

Example of passing a function pointer to another function

a guest
Jan 26th, 2013
2,451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement