Question: Translate the following C code into Mips For the strcpy() function, jal and jr are needed(function call). str1 (static memory allocation i.e: .data ......). str2
Translate the following C code into Mips
For the strcpy() function, jal and jr are needed(function call). str1 (static memory allocation i.e: .data ......). str2 (dynamic memory allocation)
#include
#include
#include
int main()
{
char str1[20]="Hello World";
char *str2;
str2 = (char*)malloc(sizeof(char)*20);
strcpy(str2,str1);
printf("str2 is: %s",str2);
return 0;
}
Result :
str2 is: Hello World
Thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
