Question: convert line by line to assembly, must read a string using syscall 8 and use a_to_i. use syscall 1 to print the integer. address of

convert line by line to assembly, must read a string using syscall 8 and use a_to_i. use syscall 1 to print the integer. address of the string read by main must be passed to a_to_i as an argument in register $a0, and the resulting integer value must be returned in register $v0.

 convert line by line to assembly, must read a string using

#program takes in a string of digits and converts them to integers until 0 is entered, at which point the program ends #include #include char input [22] I To read in a string of up to 20 digits plus newline and null int a_to_i(char* str); int mainO int value = 1; /Do the following inside a loop while(value !=0){ printf("enter string:"); fgets (input, 22, stdin) value = a-to-i (input); printf("%d ", value); int a_to_i(char* input) int result = 0; int i; for (i= 0; input [i] ++i) { != result = result * 10 + input [i] - '0'; ' '; return result

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!