百科知识

函数指针

2008-12-01 09:50:00榕***
函数指针:void entryApi(Print_fun_t func){fp = func;//将函数指针赋值,传递函数的地址}entryApi(print_?

最佳回答

  • void entryApi(Print_fun_t func){fp = func;//将函数指针赋值,传递函数的地址}entryApi(print_func); //这里执行,将print_func的所指地址作为参数传递,由于fp等是全局变量,所以经股票这一步,fp指向函数print_func(int a) 的地址可尝试printf("%x\n",&print_func);entryApi(print_func);fp(2008);printf("0x%x",fp);你自己看一下结果
    2008-12-02 08:20:00
  • 输出形式是:hello 2008
    2008-12-01 18:41:00
  • 很赞哦! (253)