Re: [問題] 原來這樣寫是沒意義的

看板C_and_CPP作者 (一定要喝溫開水!!!)時間16年前 (2009/04/23 06:59), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
※ 引述《QQ29 (我愛阿蓉)》之銘言: : new的應該不可能 我在想 靜態的array 傳給副程式應該是有辦法取得長度吧??? : 請各位給點指教thx~~ 可以做的到, use template template <class Type, int Size> void init(Type (&array)[Size]) { cout << sizeof(array) << endl; } int main() { double array[20]; cout << sizeof(array) << endl; init(array); } both of the output are 160. XDXD -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 139.175.68.252
文章代碼(AID): #19y17H-X (C_and_CPP)
文章代碼(AID): #19y17H-X (C_and_CPP)