One of my homework questions was to find the 3rd element stored in an array in MIPS, here is my code
la $t0, array0 # Loads the address of variable array0 into $t0
lw $t1, 12($t0) # Loads the value of the 3rd element of variable array0 using the address stored of array0 in $t0 into $t1
li $v0, 1 # Set $v0 to 1, this tells syscall to # print the integer specified by $t1
syscall # Now print the integer
Now the next instruction is to store the value in the register $s2. My confusion at this moment is whether to use SW(store word) $s2, $t1 or LW(load word) $s2, $t1. If anyone could please give a sound explanation of the what the correct answer is and how to figure out when to use SW or LW, would be very much appreciated.