// test12.cpp : Defines the entry point for the console application. // #include "stdafx.h" void func(int i) { printf("This is for test %i\r\n", i); } typedef void (*PFUNC)(int); struct FUNC { PFUNC pfunc; }; void callfunc(void pfunc(int), int i) { pfunc(i); } int main(int argc, char* argv[]) { void (*pfunc)(int); pfunc = &func; pfunc(1); callfunc(pfunc, 2); FUNC sfunc; sfunc.pfunc = &func; sfunc.pfunc(3); return 0; } |
闂傚倸鍊峰ù鍥Υ閳ь剟鏌涚€n偅宕岄柡宀€鍠栭、娑樷堪閸愮偓姣夋俊鐐€戦崕鏌ュ垂閸ф钃熼柣鏃囥€€閸嬫挸鈽夊▍顓т簼閹便劑宕惰閺€鑺ャ亜閺囩偞顥為悗姘炬嫹闂傚倸鍊风粈渚€骞栭銈嗗仏妞ゆ劧绠戠壕鍧楁煕閹邦垼鍤嬮柤鏉挎健閺屾稑鈽夊▎鎰▏缂傚倷璁查弲鐘诲蓟閻旂⒈鏁嶆繝濠傚枤閺嗩厼顪冮妶鍐ㄥ姷闁瑰嚖鎷�>>
正在阅读:C++基础:函数指针调用方式C++基础:函数指针调用方式
2004-03-16 15:14
出处:CSDN
责任编辑:linjixiong