函数名称前的星号是什么意思? [英] What does an asterisk before a function name mean?
本文介绍了函数名称前的星号是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在以下代码行中,dup_func,free_func和clear_free函数前面的星号是做什么的?
In the following lines of code, what does the asterisk in front of dup_func, free_func, and clear_free func, do?
void *(*dup_func)(void *);
void (*free_func)(void *);
void (*clear_free_func)(void *);
推荐答案
在您的示例中,这意味着它们是函数指针.
In your examples it means they are function pointers.
简而言之,它们允许您执行以下操作:
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);
这篇关于函数名称前的星号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文