Re: [問題] 關於宣告指標函式陣列

看板C_and_CPP作者 (Cary Wu)時間9年前 (2014/09/26 16:55), 9年前編輯推噓2(200)
留言2則, 2人參與, 最新討論串2/2 (看更多)
: int ArrayNum[2]={1,2} ArrayNum is -> [2]: an array of <- int: int : void f1(int) f1 is -> (int): a function take int as argument and return <- int: int : void (*)(int) ArrayFuncPtr[2] ={ f1 , f2 }; ArrayFuncPtr -> [2]: is an array of <- (int): ??? (function 一定要在右邊,也不是 int) <- (*): pointer...??? nonsense <- void: ??????? : void (*ArrayFuncPtr[2])(int) ={ f1 , f2 }; ArrayFuncPtr is -> [2]: an array of <- (括號裏面先做) *: pointer to -> (int): a function take int as argument and return <- void: void 不過還是善用 typedef 讓生命更美好。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.34.244.41 ※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1411721710.A.49C.html

09/26 17:20, , 1F
感謝解答,另外請問typedef以這個例子來說要怎改寫?
09/26 17:20, 1F
http://ideone.com/cF0LHN ※ 編輯: carylorrk (1.34.244.41), 09/26/2014 17:50:40

09/26 23:03, , 2F
講的真清楚
09/26 23:03, 2F
文章代碼(AID): #1K9IdkIS (C_and_CPP)
文章代碼(AID): #1K9IdkIS (C_and_CPP)