为什么这些函数名称放在括号中? [英] Why are these function names in parenthesis?
本文介绍了为什么这些函数名称放在括号中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直想问这个问题已有一段时间了.这些功能是怎么回事?为什么在括号中使用名称?
I've been meaning to ask this question for a while now. What's going on with these functions? Why are the names in parenthesis?
void (*think)(gentity_t *self);
void (*reached)(gentity_t *self); // movers call this when hitting endpoint
void (*blocked)(gentity_t *self, gentity_t *other);
void (*touch)(gentity_t *self, gentity_t *other, trace_t *trace);
推荐答案
在您的示例中,函数名称中的括号表示指向函数地址的变量.如果您不使用括号
In your examples, the parenthesis in function name means that variable of pointing the function address. If you don't use the parenthesis
void * think(gentity_t *self);// equal (void *) think(gentity_t *self);
这意味着使用以下名称定义函数:think,返回:void *,参数:gentity_t * self;这些是指向函数的变量.
It means the definition of a function with name:think, return: void *, parameter: gentity_t *self; These are the variable of the pointing the functions.
这篇关于为什么这些函数名称放在括号中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文