函数名前的星号是什么意思?

Mat*_*att 5 c function-pointers operators

在以下代码行中,dup_func,free_func和clear_free func前面的星号是做什么的?

void *(*dup_func)(void *);
void (*free_func)(void *);
void (*clear_free_func)(void *);
Run Code Online (Sandbox Code Playgroud)

cni*_*tar 10

在您的示例中,这意味着它们是函数指针.

简而言之,它们允许您执行以下操作:

void example()
{
    printf("Example called!\n");
}

void call_my_function(void (*fun)())
{
    printf("Calling some function\n");
    (*fun)();
}

/* Later. */
call_my_function(example); 
Run Code Online (Sandbox Code Playgroud)