Alessandro Lorusso
Alessandro Lorusso

Reputation: 357

What becomes of an array of integers when you offset the starting address in MIPS?

If you have a word array in MIPS consisting of numbers (5, 3, 0, 19) that has a starting address in, let's say, $t1, and I add 4 to $t1 (the starting address) I understand that 0($t1) would now contain 3 instead of 5. However, would the actual contents of the array change? As in would the array still be (5, 3, 0, 19) or would it now be (3, 0, 19) because i added to the starting address?

Upvotes: 0

Views: 63

Answers (1)

Peter Cordes
Peter Cordes

Reputation: 365881

addiu $t1, $t1, 4 doesn't change the contents of memory.

Just like in C, int *p = array; p+=4; doesn't change the array.

Upvotes: 1

Related Questions