Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

動態配置多維指標陣列?

0 views
Skip to first unread message

笨鳥

unread,
Apr 6, 1999, 3:00:00 AM4/6/99
to
各位好:
又遇到老問題了...
我想動態配置一個二維陣列, 陣列內容為指標。
若不是動態配置, 使用靜態配置是不是如下:

class Ptr {
:
:
};
:
:
Ptr* matrix[ROWS][COLS];

回到原題, 使用動態配置, 是不是該改成...

Ptr* **matrix;
:
matrix=new Ptr**[n]; // n為執行時期輸入
for (i=0; i<n; i++) matrix[i]=new Ptr*[n];

Thank you all!

--
╒══════╒══── ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ Graduate
╒╧══════ │ ﹏﹏ ─── ̄ ̄ Institute
│★ │ ﹏﹏ ── ̄ ̄ of
╭╯ ╭----- │ M.I.S.
│ ||Falcon/笨鳥 ───┘ NYUst
◤ ∟═╩═══ E-mail: gmi...@mis.yuntech.edu.tw
--
[m● Origin : 雲林科技大學藍天使 <bbs.yuntech.edu.tw> [FROM: 140.125.81.83]

0 new messages