在bootwince.c中,do_bootwince{}函數最後調用了((void (*)(void)) addr) ();函數。
#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;
}
子函數通過函數指針來調用函數。