Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- typedef void func_t(int);
- //these two function declarations are equivalent:
- void print1(int x);
- func_t print2;
- func_t *p; //p is a pointer to a function;
- void (*q)(int); //equivalent function-pointer declaration
- void print(int x){
- printf("%d\n", x);
- }
- int main(){
- p = &print; //p now points to the "print" function
- //equivalent function calls:
- p(5);
- (*p)(5);
- print(5);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement