Re: [問題] 陣列和指標的問題

看板C_and_CPP作者 (sbr)時間16年前 (2009/05/07 16:02), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《heathlow ()》之銘言: : int (*match_buf)[2] = new int[m_iNum1][2]; : 上面這一行程式, : 我在VC中編譯可以過. : 如果拿掉等號左側的括號變成 : int* match_buf[2] = new int[m_iNum1][2]; : 就會出錯. : 我想請問一下原因是甚麼? 前者 match_buf 是一個 pointer, point to array(int[2])。 後者 match_buf 是一個 length 為 2 的 pointer array。(match_buf[0], match_buf[1] 的 type 是 int*) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.173.130.231
文章代碼(AID): #1A0mOl_L (C_and_CPP)
討論串 (同標題文章)
文章代碼(AID): #1A0mOl_L (C_and_CPP)