关于函数指针

来源:互联网 发布:移动数据安全 编辑:程序博客网 时间:2024/06/06 06:59
#include <iostream>using namespace std;typedef int (*f)(int,int);int fun(int a,int b){return a+b;}int test(f fi,int a,int b){    return fi(a,b);}int main(int argc, const char * argv[]) {    f f2=&fun;    cout<<f2(1,3)<<endl;    cout<<test(fun,1,2)<<endl;    return 0;}


0 0
原创粉丝点击