※ 引述《lovefo (lovefo)》之銘言:
: suppose we have a byte-addressable machine,i.e.,each byte is accessed via an
: address.Let the locations of an array be allocated in a row-major manner,and
: each element takes one byte.What is the address of the element B[5][15][25]
: in an array declared as B[10][20][30]?
: Asume that the address of the first byte of the array is 5000.
: 解答是給:
: 5000+(5*20*30+15*30+25)*1 = 8475
: 我是算:
: 5000+(5*20*30+14*30+25)*1 = 8445
: 是否能請大大們撥空幫我算看看
: 謝謝
我覺得有以下這兩種答案 // 起始 index 差別
A、5000+(5*20*30+15*30+25)*1
B、5000+(4*20*30+14*30+24)*1
有錯還請指正
--
歡迎參觀 :)
我的露天拍賣: http://class.ruten.com.tw/user/index00.php?s=outdoorsell
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.57.78.231