C++函数指针
来源:互联网 发布:网络机顶盒 会员 编辑:程序博客网 时间:2024/06/03 17:02
#include <iostream>
using namespace std;
using namespace std;
int test(int,int);
int _tmain(int argc, _TCHAR* argv[])
{
#ifdef __STDC__
cout<<"这是 C 程序。"<<endl;
#endif
#ifdef __cplusplus
cout<<"这是C++程序。"<<endl;
#endif
typedef int (*pf)(int,int);
pf p;
p = test;
cout<<p(10,20)<<" | "<<(*p)(11,12)<<" | "<<(*p)(1,2)<<endl;
system("pause");
return 0;
}
{
#ifdef __STDC__
cout<<"这是 C 程序。"<<endl;
#endif
#ifdef __cplusplus
cout<<"这是C++程序。"<<endl;
#endif
typedef int (*pf)(int,int);
pf p;
p = test;
cout<<p(10,20)<<" | "<<(*p)(11,12)<<" | "<<(*p)(1,2)<<endl;
system("pause");
return 0;
}
int test(int m,int n)
{
cout<<m<<"进入测试 指针函数"<<n<<endl;;
return m*n;
}
{
cout<<m<<"进入测试 指针函数"<<n<<endl;;
return m*n;
}
执行结果:
这是C++程序。
1进入测试 指针函数2
11进入测试 指针函数12
10进入测试 指针函数20
200 | 132 | 2
可以看出是从右向左执行。
可以看出是从右向左执行。
阅读全文
0 0
- C指针函数 && 函数指针
- C++----函数&函数指针
- C++,C函数指针
- C/C++:函数指针
- 【c/c++】指针函数和函数指针
- 【C和指针】函数指针
- 《c和指针》函数指针
- c语言函数指针
- C/C++函数指针
- C语言函数指针
- [C]函数指针数组
- C 函数指针
- C 函数指针数组
- c 函数指针
- c/c++函数指针
- c 函数指针
- c中的函数指针
- c函数指针
- CodeIgniter配置之database.php用法实例分析
- pom.xml Element connectors is not allowed here
- c语言创建写入和读取TXT文件数据
- 使用程序自动登录网站
- bzoj3698 XWW的难题(有源汇有上下界最大流)
- C++函数指针
- java线程同步
- 图片加遮蔽层
- oj 图书管理(list)
- libpcap抓包程序
- 吃鸡数
- 目标检测--Single-Shot Refinement Neural Network for Object Detection
- 手把手教你集成滴滴的插件化框架virtualapk
- linux tail 命令动态显示日志信息