[英]What does an asterisk before a function name mean?
In the following lines of code, what does the asterisk in front of dup_func, free_func, and clear_free func, do?在下面的代码行中,dup_func、free_func 和 clear_free func 前面的星号是做什么用的?
void *(*dup_func)(void *);
void (*free_func)(void *);
void (*clear_free_func)(void *);
In your examples it means they are function pointers .在您的示例中,这意味着它们是function 指针。
In a nutshell, they allow you to do things like this:简而言之,它们允许您执行以下操作:
void example()
{
printf("Example called!\n");
}
void call_my_function(void (*fun)())
{
printf("Calling some function\n");
(*fun)();
}
/* Later. */
call_my_function(example);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.