精力有限,就不写前言后序了,懂的都懂,直接上代码。
快速回忆点:
# 类型定义
typedef int (*my_func_t)(int a, void *b)
# 函数指针数组结构体定义
struct my_ops {
int (*func[FUNC_TYPE_MAX])(int a, void *b);
};
# 函数指针数组结构化初始化
struct my_ops real_ops = {
.func = {
[FUNC_TYPE_2] = real_func,
}
};
定义函数类型
<