Review: Function Pointer

Two ways to make use of it:
1) directly declare a function pointer variable at the place where it's required. like below:
void (*pFunc)(int); // pFunc is a variable here
pFunc = &FuncA;
pFunc(2);
2) typedef a function poiner type and then use it. like below:
typedef void (*pFunc)(int);
pFunc pFuncObj = &FuncA;
pFuncObj(2);
posted @ 2011-07-01 15:42  能巴  阅读(144)  评论(0编辑  收藏  举报