Question
Write a MIPS program that asks the user to input string. The program then removes all space characters from the string. The program finally displays
Write a MIPS program that asks the user to input string. The program then removes all space characters from the string. The program finally displays the resulting string without spaces.
The following C code shows the proposed algorithm. The string is traversed with two indices, called old_index and new_index, where the latter always takes a value less or equal to the former. When a non?space character is found, the character at position old_index is copied to position new_index, and both indices are incremented. When a space is found, the current character is not copied, and only old_index is incremented. The algorithm stops when a null character is found.
#includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started