# copy data from first struct to second lw $t0,0($s1) # copy age from first sw $t0,0($s2) # to second struct lw $t0, 4 ($s1) # copy pay from first sw $t0, 4 ($s2) # to second struct lw $t0, 8 ($s1) # copy class from first sw $t0, 8 ($s2) # to second struct
Students who rush through this material often pay for their speed with hours of confusion later on. Working with addresses and the contents of addresses can be confusing. I speak from experience here, both experience with students and experience in being confused.
The classic prevention to classic confusion is to study a simple program. Such as this one. Copy the program into your editor, paste it to a file and play with it.
The program is more interesting if it writes some output. Here is another block of code to insert just before the end:
You weren't expecting to get that code for free, were you? Fill in those blanks.
Hint: pick from li
, la
, and lw
for each blank.