推 ROGER2004070:下午要去運動會看摸彩有沒有中! 12/05 11:12
範例:
void test(int **array)
{
//印出陣列內容
for(int i=0; i<rowsize; i++)
for(int j=0; j<colsize; j++)
print("%d ",array[i][j]);
}
main()
{
int *ptr;
//malloc二維陣列
//ptr = new int(rowsize);
for( int i=0; i<rowsize; i++ )
{
ptr[i] = new int(colsize);
}
test( ptr );//以指標傳遞陣列
}
恩...我好無聊..話說今天有校運會耶..
睡太晚了..沒看到早上的表演..殘念Orz
不過晚上有演唱會耶..有人要去看嘛?
※ 引述《sambacool ( !!!!!!!美珍魂!!!!!!!!)》之銘言:
: 求救一下
: 一個size未定的二維陣列
: 用來當函數內的引數傳遞時
: 函數要如何宣告?
: 以及呼叫函數時的寫法?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.243.10
※ 編輯: dgf130 來自: 140.113.243.10 (12/05 10:29)