面试题答案
一键面试#include <stdio.h>
// 定义加法函数
int add(int a, int b) {
return a + b;
}
int main() {
// 定义函数指针,指向返回值为int,参数为两个int类型的函数
int (*func_ptr)(int, int);
// 让函数指针指向add函数
func_ptr = add;
// 使用函数指针调用add函数
int result = func_ptr(3, 5);
printf("结果是: %d\n", result);
return 0;
}