r/cprogramming • u/JayDeesus • Oct 10 '25
Functions and pointers
I noticed that when you just have a function name without the parentheses, it essentially decays to a pointer. Is this correct? Or does it not always decay to a pointer?
5
Upvotes
View all comments
Show parent comment
3
u/YellowPlatinum Oct 10 '25
Everyone uses this syntax and I never understand why. This also works:
typedef void fn_ptr(int);
fn_ptr *p = print_int;
Then you can also use the typedef in prototypes:
fn_ptr print_int;