[問題] 2D陣列傳值
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
DEV C++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
一直出現[Warning]passing argument 1 of 'fnuctionName'from incompatible
pointer type [enabled by default]
[NOTE]expected 'int(*)[30]' but argument is of type 'int **'
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
int *index[30];
for(i=0;i<someNumber;i++)
index[i] = (int*)malloc(arrLen*sizeof(int));
...
...
...
sort2DArray(index, someNumber, arrLen);
....
void sort2DArray(int (*array)[30], int someNumber, int arrLen)
{
....
}
補充說明(Supplement):
我想建一個行列可自訂的ARRAY(一個上限為30)然後排序,但怎麼樣都不行
不知哪裡有錯,也不知怎麼改...
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.170.213.8
※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1417104808.A.2FE.html
→
11/28 00:20, , 1F
11/28 00:20, 1F
→
11/28 00:22, , 2F
11/28 00:22, 2F
→
11/28 00:25, , 3F
11/28 00:25, 3F
→
11/28 00:27, , 4F
11/28 00:27, 4F
→
11/28 00:28, , 5F
11/28 00:28, 5F
→
11/28 00:31, , 6F
11/28 00:31, 6F
→
11/28 00:32, , 7F
11/28 00:32, 7F
→
11/28 00:33, , 8F
11/28 00:33, 8F
→
11/28 00:41, , 9F
11/28 00:41, 9F