代码拉取完成,页面将自动刷新
#include <stdio.h>
void call_back_func0() { printf("callback function 0 called\n"); }
void call_back_func1() { printf("callback function 1 called\n"); }
void call_back_func2() { printf("callback function 2 called\n"); }
void call_back_func3() { printf("callback function 3 called\n"); }
enum event_type { EVENT0 = 0, EVENT1, EVENT2, EVENT3, EVENT_MAX };
void (*func[])(void) = {
call_back_func0,
call_back_func1,
call_back_func2,
call_back_func3,
};
void handle_event(int event_type, void (*callback)(void)) {
printf("event %d occured\n", event_type);
if (callback) {
callback();
}
}
void func_ptr_demo() {
for (int idx = 0; idx < EVENT_MAX; idx++) {
func[idx]();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。