代码改变世界

函数指针

2022-11-17 21:13  钟铧若岩  阅读(11)  评论(0编辑  收藏  举报

 

 1 #include <cstdio>
 2 #include <iostream>
 3 using namespace std;
 4 int max(int x,int y)
 5 {
 6     return x>y?x:y;
 7 }
 8 int main()
 9 {
10     int max(int,int);
11     int (*p)(int ,int) = &max;    
12     int c = (*p)(2,3);
13     printf("the max is %d",c);
14 }