函数指针数组使用(only a demo)

#include <iostream.h> static char* Fun1(int** length) { char *str = "Callback Fun1()"; cout<<"fun1 length is:"<<(**length)<<endl; return str; } static char* Fun2(int** length) { char *str = "Callback Fun2()"; cout<<"fun2 length is:"<<(**length)<<endl; return str; } static char* Fun3(int** length) { char *str = "Callback Fun3()"; cout<<"fun3 length is:"<<(**length)<<endl; return str; } void main() { int a = 9; int* b = &a; int** c = &b; char* pTemp; char* (*pFun[3])(int**) = {Fun1,Fun2,Fun3}; pTemp = pFun[0](c); cout<<pTemp<<endl; pTemp = pFun[1](c); cout<<pTemp<<endl; pTemp = pFun[2](c); cout<<pTemp<<endl; } 

only a demo...

你可能感兴趣的:(函数指针数组使用(only a demo))