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

作者: Ommm5566 (56天團)   2016-07-01 20:31:07
開發平台(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
作者: Schottky (順風相送)   2016-07-01 20:32:00
pfnWndProc 是 function pointer不是把 WndProc() 執行後的傳回值放進 pfnWndProc
作者: vaio8937 (直把杭州當汴州)   2016-07-01 21:07:00
他不是在呼叫函式他只是把名稱當作指標傳遞

Links booklink

Contact Us: admin [ a t ] ucptt.com