标签:函数 main success call 使用 oid get cal pause
//函数指针定义 //1 typedef int(fun_point1)(int, int); int get_sum(int a, int b) { return a + b; } typedef int(*fun_point2)(int, int); int main(void) { //call function fun_point1* p = get_sum; int sum = p(3, 2); cout << "sum = " << sum << endl; fun_point2 p2 = get_sum; sum = p2(3, 4); cout << "sum = " << sum << endl; //经常使用 int(*fun_point3)(int, int) = get_sum; int n = fun_point3(6, 8); cout << "n =" << n << endl; system("pause"); return EXIT_SUCCESS; }
标签:函数 main success call 使用 oid get cal pause
原文地址:https://www.cnblogs.com/mayichen0823/p/10188810.html