use*_*717 3 c pointers function-pointers
是否可以创建指向函数指针的指针,即
int32_t (*fp[2])(void) = {test_function1, test_function_2}; // initialize a function pointer
<unknown> = fp;
Run Code Online (Sandbox Code Playgroud)
需要写什么来代替未知?使用"普通"数组,我可以这样做:
int a[2] = {0, 1};
int* p = a;
Run Code Online (Sandbox Code Playgroud)
提前谢谢了.
Lun*_*din 21
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
Run Code Online (Sandbox Code Playgroud)