Is it possible to pass a function pointer as an argument to a function in C?
If so, how would I declare and define a function which takes a function pointer as an argument?
Definitely.
void f(void (*a)()) { a(); } void test() { printf("hello world "); } int main() { f(&test); return 0; }
2.1m questions
2.1m answers
60 comments
57.0k users