Question: The following C program asks the user for two input null-terminated strings, each stored in uninitialized 100-byte buffer, and compares them. The program then shows
The following C program asks the user for two input null-terminated strings, each stored in uninitialized 100-byte buffer, and compares them. The program then shows the alphabetical order of both strings, by reporting whether the first is less than the second, the second is less than the first, or both are equal.

Write a full MIPS program that provides the exact same output as the reference C code, including all messages shown to the user.
#include stdioh> int main() // Two strings, 100 bytes allocated for each char si [100; char s2 [100]; // Read string 1 printf("Enter string scanf("%s", s1); 1: "); // Read string 2 printf("Enter string scanf("%s", s2); 2: "); // Compare them int index = 0; while (1) / Load characters from s1 and s2 char c1 = s1[index]; char c2 = s2[index]; // Current character is greater for s1 if (c1 > c2) printf("s1 > s2 ") break; // Current character is greater for s2 if (c1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
