C语言的函数指针: /**//************************************************************ Copyright (C), 1998-2006, Rx. Co., Ltd. FileName: mainApp.cpp Author: longronglin Version : 1.0 Date: 2006-10-11 Description: Function List: 1. int main() History: <author> <time> <version > <desc> longronglin 2006/10/11 1.0 modify xxx . ***********************************************************/#include <iostream.h> #include <stdio.h>/**//* * 返回1为正确执行 * 主函数 * */int test(int a) ...{ return a; }char chrTest(char b)...{ return b;}int main()...{ //显示函数地址 cout<<test<<endl; int (*fp)(int a); char (*charFp)(char b); //将函数test的地址赋给函数指针fp fp=test; //上面的输出fp(5),这是标准c++的写法,(*fp)(10)这是兼容c语言的标准写法,两种同意,但注意区分,避免写的程序产生移植性问题! cout<<fp(5)<<"|"<<(*fp)(10)<<endl; charFp=chrTest; cout<<chrTest<<endl; cout<<charFp('A')<<endl; cin.get(); return (1);} 运行实现: 内存结构图: