Search code examples
arraysstringmipsmars-simulator

MIPS - How to allocate memory for an array of integers that come from string?


Suppose there is a string:array: .asciiz "4 5 64 12 78"

Then how to allocate memory for an array that has to be created out of this string?


Solution

  • You can just use the .space directive, e.g.

            .data
    array:  .asciiz "4 5 64 12 78"
    array2: .space 40       # allocate 40 bytes