2-d Arrays in MIPS (cont)
Representations of int matrix[4][4] ...
matrix: .space 64
row0: .space 16
row1: .space 16
row2: .space 16
row3: .space 16
matrix: .word row0, row1, row2, row3
|
Now consider summing all elements
int i, j, sum = 0;
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++)
sum += matrix[i][j];
|
|