Need help with callbacks

closed account (17pz3TCk)
So for an assignment I need to implement a callback and I need help. I have 3 files to write. The second and third file implement the callback functions. The first file needs a mechanism for accepting but can not #include the other 2 files.

My question is how do I make the functions in files 2&3 known to file 1 if it can't #include the file?
make the functions global. and then use #extern to access them.
And before you ask, yes you can pass functions as arguments to other functions by passing a prototype. Like so:
void foo(void (*func)(void));

EDIT: You don't pass a prototype, you pass a function pointer. Sorry for any confusion.
Last edited on
Topic archived. No new replies allowed.