aboutsummaryrefslogblamecommitdiff
path: root/compile_data/func_pointer.c
blob: f239b552bcad00bc07af8a87a8949eb7473ccc09 (plain) (tree)
1
                  


















                                            
#include <stdio.h>
typedef void (*Func_t)();
void f(Func_t func, int step) {
    if (!step) return;
    printf("i'm f\n");
    func(func, step - 1);
}
void g(void (*func)(), int step) {
    if (!step) return;
    printf("i'm g\n");
    func(func, step - 1);
}
int main() {
    void (*func)(void (*ifunc)(), int step);
    int x = 1;
    if (x) func = f;
    else func = g;
    func(func, 5);
    return 0;
}