Re: [問題] 請教 Function Pointer 的觀念
※ 引述《sawang (New Friends)》之銘言:
: ※ 引述《jimmy2266 (2266)》之銘言:
: : 為什麼不能 bool (*compare) 就好??
: 這樣沒有宣告你要的函數需要幾個parameters
: : 為什麼不能 bool *compare( int, int ) ??
: 這樣那個*號變成是跟bool連在一起的,表示回傳值是指向bool型態的指標
: 而不是表示compare是function pointer
: : 為什麼不能 bool compare( int, int ) ??
來補個問題好了
我看過的程式碼
int foo (int , int , void ( func)(void *, const DWORD) );
int foo1 (int , int , void ( *func)(void *, const DWORD) );
foo和foo1裡面的func傳入的東西都是一樣,都是一個callback function。
foo1裡的func應該是function pointer,因為他多一個*,而且手頭上能找到的
function pointer都是長的像foo1的那副德性。
那foo的func又是什麼東西? 感覺像是pass by value。
--
或許人生是一段整合內在的自己
並尋求人間一點真情的過程吧
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.115.240.57
※ 編輯: aecho 來自: 59.115.240.57 (03/07 07:50)
推
03/07 21:21, , 1F
03/07 21:21, 1F
→
03/07 21:21, , 2F
03/07 21:21, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 4 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章