In MIPS, I know that I can declare an array as:
list: .space 20
However, what if I wanted to create an array of different size based on user input?
Is this possible?
For example, the program would ask the user to input an integer N and create an array of length N.
That’s a good question. In assembly language, variables declared as you’ve done are statically allocated, that is they’re allocated at assembly time. If you want to allocate a variable based on user input at run time you have at least two choices: Allocate space on the stack (and watch for stack overflow) or allocate from a memory pool, usually called the heap. In either case, the allocation is done at rum time rather than at assembly time.