Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在用 Mips 汇编语言转换一个 C++ 项目。在 c++ 中,您可以初始化一个数组,如
int array[5]={1,2,3,4,5};
如何在 MIPS 汇编语言中初始化字符数组?
在 MIPS 汇编中,您将指示汇编器为数组静态分配足够的内存,并使用指令.data和.word. 例如:
.data
.word
.data arrayOfInts: .word 1, 2, 3, 4, 5 arrayOfChars .word 'a', 'b', 'c'
这适用于编译时定义的变量。如果您的意图是动态分配数组,您必须自己做。