C function pointers

后端 未结 3 1878
攒了一身酷
攒了一身酷 2021-01-25 00:04
static void increment(long long *n){
  (*n)++;
}

struct test{
  void (*work_fn)(long long *);
};

struct test t1;

t1.work_fn = increment;

How do I ac

3条回答
  •  攒了一身酷
    2021-01-25 00:34

    Yes, that's how to call it. Function names and variables containing function pointers are essentially the same thing.

提交回复
热议问题