Question: Convert C to Mips assembly // c program #include #include #define MAX_SIZE 40 // Maximum string size declaration // Function declaration for removing the all
Convert C to Mips assembly
// c program #include
// Function declaration for removing the all occurance of a given character void MIPS (char *, const char);
int main() { char str[MAX_SIZE]; //string declaration char charToRemove; // character declarction for removal form string
// getting string from user input printf("Enter your string: "); gets(str);
//Infinite loop for removing character from the given string until there is new line character has been inputed by the user for(; ;){ printf("Enter a character: "); charToRemove = getchar(); if(charToRemove == "10"){ return 1; break; } else{ MIPS (str, charToRemove); printf("String after removing '%c': %s ", charToRemove, str); } } return 0; }
// Function defination to remove all occurrences of a character from the given string.
void MIPS (char * str, const char toRemove) { int i, j; int length = strlen(str);
for(i=0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
