Question: Write MIPS code that converts a string containing a number into an actual number. The function to do this conversion, atoi (Array To Integer) should

Write MIPS code that converts a string containing a number into an actual number. The function to do this conversion, atoi (Array To Integer) should have a single input (the string) and output a single number (the integer). The Java/C code is as follows:

atoi(a0: array) {

int digit, number, i = 0;

while( (array[i] >= '0') && (array[i] <= '9') )

{ digit = array[i] - '0';

number = 10 * number + digit;

i++;

}

return number;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!