[問題] 列行 誰會算呢?

看板TransCSI作者 (薄荷巧克力)時間14年前 (2010/03/05 18:54), 編輯推噓3(302)
留言5則, 4人參與, 最新討論串1/1
A 10*10 array A is stored in main memory using row-major arrangement. Its starting address (address of A[0][0]) is 300, and the address of A[1][2] is 324. what is the address of the array element A[2][3]? 答案是347  可是我怎麼算都是351  到底錯在那裡阿  希望會的大大們 幫我解答 thx -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.47.8.133

03/05 21:02, , 1F
怎麼看起來像346
03/05 21:02, 1F

03/05 21:17, , 2F
令此陣列每個元素為x bytes. 則 300+10*1*x+2*x = 324
03/05 21:17, 2F

03/05 21:18, , 3F
故x=2, A[2][3]的位置為 300 + 10*2*x + 3*x = 346
03/05 21:18, 3F

03/06 09:10, , 4F
嗯 謝謝andy大 我知道怎麼算了 應該是346拉
03/06 09:10, 4F

03/07 18:13, , 5F
嗯~我也是算346
03/07 18:13, 5F
文章代碼(AID): #1BaEBb2h (TransCSI)