jason@ubuntu:~/test$ cat a.c #include <stdio.h> void(* fpp)(void); static void fp(void){ printf("fp is called\n"); return; } void set_f(void){ fpp =fp; printf("set_f is called\n"); return; }
jason@ubuntu:~/test$ cat b.c #include <stdio.h> extern void(* fpp)(void); void set_f(void); int main() { printf("in main\n"); set_f(); fpp(); return 0; }
jason@ubuntu:~/test$ gcc a.c b.c