typedef void(*pfunc)(void);
void msg_pfunc(void)
{
printf("Hello pfunc...\n");
}
void test_func(void)
{
printf("\ntest1....\n");
unsigned int addr = (unsigned int)&msg_pfunc;
((void(*)(void))addr)();
printf("\ntest2....\n");
pfunc pfun = (pfunc)addr;
pfun();
printf("\ntest3....\n");
((pfunc)addr)();
}
int main()
{
test_func();
return 0;
}
vc6.0运行的结果,,呵呵,学习了。。。
test1....
Hello pfunc...
test2....
Hello pfunc...
test3....
Hello pfunc...
Press any key to continue |