C++ 函数指针

普通指针语法:

datatype *var_name;
int* ptr;
uint_8 *buffer;

函数指针语法:

return_type (*FuncPtr) (parameter type, ....);  

应用场景:

  1. 利用函数指针来调用函数:dlopen/dlsym
  2. 将函数作为参数传入:例如比较不同排序方法的结果

函数指针的typedef:

typedef return_type (*alias_name)(parameter_types and numbers....);

参考链接:

posted @ 2025-04-12 17:22  梦一场6688  阅读(14)  评论(0)    收藏  举报