是否可以创建指向函数指针的指针,即
int32_t (*fp[2])(void) = {test_function1, test_function_2}; // initialize a function pointer
<unknown> = fp;
需要写什么来代替未知?使用“普通”数组,我可以这样做:
int a[2] = {0, 1};
int* p = a;
非常感谢。
最佳答案
typedef void(*func_ptr_t)(void); // a function pointer
func_ptr_t* ptr_to_func_ptr; // a pointer to a function pointer - easy to read
func_ptr_t arr[2]; // an array of function pointers - easy to read
void(**func_ptr_ptr)(void); // a pointer to a function pointer - hard to read
void(*func_ptr_arr [2])(void); // an array of function pointers - hard to read
关于c - 指向函数指针的指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26013407/