Re: [問題] 如何讓函數回傳二維陣列?
其實你如果只是要處理過後的資料,不需要回傳二維陣列
int data_value[10][10];
int process (int[][]& datavalue); //沒compiler不知道這樣宣告是不是對的
將你要處理的二維陣列以參數reference傳入,處理完後return true;這樣就好了
※ 引述《atomuu (小原子)》之銘言:
: 開發平台(Platform): (Ex: VC++, Gcc, Linux, ...)
: Linux
: 額外使用到的庫(Library Used) (Ex: OpenGL, ...)
: no
: 問題(Question):
: 我在想到底要如何宣告回傳二維陣列的函數
: int[][] ABC(int X[][10])
: int X[][10]是傳入二維陣列的方法
: 好像問題出在int[][]
: 請問宣告回傳二維陣列的函數不是int[][]這樣宣告嘛?
: 查了幾本書都沒有說這樣要怎麼寫= =
: 餵入的資料(Input):
: 以上的宣告方式
: 預期的正確結果(Expected Output):
: 應該要可以編譯
: 錯誤結果(Wrong Output):
: 編譯錯誤
: error: array type has incomplete element type
: 程式碼(Code): (請善用置底文標色功能)
: 上面的程式碼
: 補充說明(Supplement):
--
To iterate is human, to recurse, divine.
遞迴只應天上有, 凡人該當用迴圈. L. Peter Deutsch
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.45.240.97
討論串 (同標題文章)