Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

What activities generated the most cash flow.

Answered: 1 week ago

Question

To what extent are entrepreneurs motivated by money?

Answered: 1 week ago