Write an assembly language
Project 4 Tip - Loading Array.html
This code can be used to load a reviewer’s score into the array of movie reviews:
; Insert score at reviews[rowIndex][colIndex]
mov edx,rowSize ; row size in bytes
mov eax,rowIndex ; row index
mul edx ; row index * row size
mov index,eax ; save row index * row size
mov eax,colIndex ; load col index
shl eax,2 ; eax = colIndex * 4
add eax,index ; eax contains offset
mov edx,score ; edx = reviewer's score
mov ebx,OFFSET reviews ; array of review scores
mov [ebx + eax],edx ; Store score for movie
Section 9.4 of your textbook deals with two-dimensional arrays. There is even an example showing how to calculate a row sum. You may be able to adapt this example to calculate a column sum.