// [[1]] 使用typedef定義函數指針為一個類型,更喜歡這種方式
typedef int (*MYFUN)(int, int);
MYFUN funcs[10];
// [[2]] 使用typedef定義函數指針數組為一個類型,不是很直觀
typedef int (*MYFUN2[10])(int, int);
MYFUN2 funcs2;
int main(int argc, char *argv[]) {
funcs[0] = add;
qDebug() << (*funcs[0])(2, 3); // 也可以用 funcs[0](2, 3).
funcs2[0] = add;
qDebug() << (*funcs2[0])(2, 3);
return 0;
}
@import url(http://www.shnenglu.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);