c - Why are these function names in parenthesis? -
this question has answer here:
- how function pointers in c work? 11 answers
- c function pointer syntax 4 answers
i've been meaning ask question while now. what's going on these functions? why names in parenthesis?
void (*think)(gentity_t *self); void (*reached)(gentity_t *self); // movers call when hitting endpoint void (*blocked)(gentity_t *self, gentity_t *other); void (*touch)(gentity_t *self, gentity_t *other, trace_t *trace);
in examples, parenthesis in function name means variable of pointing function address. if don't use parenthesis
void * think(gentity_t *self);// equal (void *) think(gentity_t *self);
it means definition of function name:think, return: void *, parameter: gentity_t *self; these variable of pointing functions.
Comments
Post a Comment