Higher-order functions: Difference between revisions
→Simple example: Removed syntax highlighting
(→[[C]]: Added syntax highlighting) |
(→Simple example: Removed syntax highlighting) |
||
Line 16:
Definition of a function whose only parameter is a pointer to a function with no parameters and no return value:
void myFuncSimple( void (*funcParameter)(void) )
{
Line 26:
/* ... */
}
Note that you ''can't'' call the passed function by " *funcParameter() ", since that would mean "call funcParameter and than apply the * operator on the returned value".
Line 32 ⟶ 31:
Call:
void funcToBePassed(void);
Line 38 ⟶ 36:
myFuncSimple(&funcToBePassed);
===Complex example===
|