MCharles
MCharles

Reputation: 299

In a MIPS Assembly Array declaration, what happens if you put a number other than 0 as the first space in the array?

When you declare an empty array in MIPS Assembly, you would write:

Array: .word 0:4

What happens if you write Array: .word 1:4 or Array: .word 3:5 or any number in the first place?

I have tried it in MARS and have not seen any side effects. Thank you!

Upvotes: 2

Views: 3062

Answers (1)

nneonneo
nneonneo

Reputation: 179717

The array declaration syntax is

.<type> <initial-value>:<count>

So, .word 1:4 means "create an array of four words, each initialized to 1". If you are treating the array as "empty" and simply writing over the array in your program, you won't see any ill effects because your program doesn't use the "empty" array value.

Upvotes: 3

Related Questions