69,371
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
void sayhello(void)
{
printf("hello godson!\n");
}
int main(void)
{
/* normally, we use a function pointer such like this. */
void (*p)(void);
unsigned int addr;
/* but we can use the address of a function directly. */
addr = sayhello;
printf("%d\n", addr);
((void (*)(void))addr)();
/* use function pointer */
p = sayhello;
p();
return 0;
}