討論串[語法] pointer to array請教
共 4 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 9→)留言9則,0人參與, 最新作者jehovah (Lucius)時間15年前 (2010/08/20 17:29), 編輯資訊
0
0
0
內容預覽:
束刪, 先謝謝指教, 真的獲益很多^^. 還有一個疑問想請教. 假設有個一維陣列 int a[4]={};. 當我取 *a時會得到 a[0] 的element 0. 而ip指向一個 int[4] 的array {1, 2, 3, 4}. 為什麼 *ip時得到的是 ia[1][0] 的位址呢?. 謝謝

推噓4(4推 0噓 14→)留言18則,0人參與, 最新作者hilorrk (Cary)時間15年前 (2010/08/19 08:37), 編輯資訊
0
0
0
內容預覽:
arr is a pointer to a pointer to an int. arr is an array of "a pointer to an int" type. arr is a pointer to an int[COL](an int array type). 其實有一定的規則可循
(還有1610個字)

推噓4(4推 0噓 5→)留言9則,0人參與, 最新作者hilorrk (Cary)時間15年前 (2010/08/18 17:57), 編輯資訊
0
0
0
內容預覽:
array是長這樣子的. 1 2 3 4. 2 4 6 8. X X X X此處ia先decay成"pointer to a int[4](a int array type)"並assign給ip. ip成為a pointer to a int array named ia[0]. 指向ia[1]的
(還有257個字)

推噓1(1推 0噓 9→)留言10則,0人參與, 最新作者jehovah (Lucius)時間15年前 (2010/08/18 17:23), 編輯資訊
0
0
0
內容預覽:
最近在看C++ primer, 看到pointers 與多維 arrays的關係. 有段code 我拿來跑跑看, 有些不清楚的地方想請教. int ia[3][4] = {. {1, 2, 3, 4},. {2, 4, 6, 8},. };. int (*ip)[4] = ia; //請問這邊=ia
(還有141個字)
首頁
上一頁
1
下一頁
尾頁