指向函数的指针_简单运用
2013-03-20 10:57
281 查看
#include <iostream> #include <string> #include <cctype> #include <assert.h> using namespace std; #define NDEBG typedef bool (*cmpFcn)(const string &, const string &); bool lengthCompare(const string &a, const string &b) { return a.size()>b.size()?1:0; } int main() { cmpFcn pf = lengthCompare; cout<<"lengthCompare(hi,bye) "<<lengthCompare("hias","bye")<<endl; cout<<"pf(hi,bye) "<<pf("hias","bye")<<endl; cout<<"(*pf)(hi,hi) "<<(*pf)("hi","hi")<<endl; }
相关文章推荐
- 简单分析 指针数组 数组指针 函数指针 函数指针数组 指向函数指针数组的指针
- C++:指向对象成员函数的指针
- 指向类成员函数的指针
- 17-block与指向函数的指针
- 指向函数的指针
- 函数返回指向自己的指针
- C语言中返回指针的函数和指向函数的指针
- 结构体中指向函数的指针
- 指向函数的指针
- 指向函数的指针数组
- 普通函数指针和指向成员函数指针
- C语言int类型指针指向char类型变量简单实例
- 指针数组、数组指针、指针函数、函数指针的简单介绍
- 【c语言】编写一个函数new,对n个字符开辟连续的存储空间,此函数应返回一个指针(地址),指向字符串开始的空间
- 指向函数的指针
- 2013-7-10学习笔记[字符串操作,指向函数的指针]
- “Caculate::writehtml”: 函数调用缺少参数列表;请使用“&Caculate::writehtml”创建指向成员的指针
- 指向函数的指针
- C++ 指向函数的指针
- 第09天C语言(08):指向函数的指针的应用场景