Re: [問題] 有關pointer
※ 引述《tinlans.bbs@whshs.cs.nccu.edu.tw (汀)》之銘言:
: ※ 引述《howay0516.bbs@ptt.cc (小浩浩)》之銘言:
: > 好久沒寫程式了 功力變很遜
: > 想問一下有關pointer的問題
: > 某 function(){
: > // Start find shortest path
: > // grids[][] and Input[][] two int dimensions array...
: > FindShortestNum( grids, Input );
: > }
: > void FindShortestNum( int** grids, int** Input ){ // test OK
: > //上面的這個參數要怎樣傳啊>"< 謝謝願意回答的強者
: > //目前這樣是錯誤
: > ....
: > ...
: > ...
: > }
: 不可以這樣傳,
: 除非你硬轉 type,
: 詳情請參閱前幾天「請問二維陣列傳值的問題」的討論串。
我都是用struct取代二維陣列
像是 struct row { int item[10]; }
再宣告struct陣列 struct row grids[10];
這樣在傳參數時就很方便...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.29.241.8
討論串 (同標題文章)
Programming 近期熱門文章
PTT數位生活區 即時熱門文章