[問題] 為什麼函式可以不用括號?(已解決)

看板C_and_CPP (C/C++)作者 (56天團)時間9年前 (2016/07/01 20:31), 9年前編輯推噓1(103)
留言4則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) VC++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) window.h 問題(Question): 為什麼第6行宣告WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 但是第32行卻可以wc.pfnWndProc = WndProc; 正常函式使用至少也要有小括號吧 例如至少 WndProc(); 餵入的資料(Input):預期的正確結果(Expected Output): 錯誤結果(Wrong Output):程式碼(Code):(請善用置底文網頁, 記得排版) http://www.winprog.org/tutorial/simple_window.html -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.233.29.223 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1467376272.A.370.html

07/01 20:32, , 1F
pfnWndProc 是 function pointer
07/01 20:32, 1F

07/01 20:32, , 2F
不是把 WndProc() 執行後的傳回值放進 pfnWndProc
07/01 20:32, 2F
原來如此 我原本看不懂前綴字pfn 原來是pointer of function.....

07/01 21:07, , 3F
他不是在呼叫函式
07/01 21:07, 3F

07/01 21:07, , 4F
他只是把名稱當作指標傳遞
07/01 21:07, 4F
看懂了 ※ 編輯: Ommm5566 (36.233.29.223), 07/01/2016 21:39:29
文章代碼(AID): #1NTcAGDm (C_and_CPP)
文章代碼(AID): #1NTcAGDm (C_and_CPP)