Question: Question 1 (5 pt.) The following C program asks the user for two input null-terminated strings, each stored in uninitialized 100-byte buffer, and compares them.

 Question 1 (5 pt.) The following C program asks the user

for two input null-terminated strings, each stored in uninitialized 100-byte buffer, and

Question 1 (5 pt.) 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 include int main // Two strings, 100 bytes allocated for each char sl [100; char s2[1001 // Read string 1 printf ("Enter string 1: ") scanf ("%s", s1); // Read string 2 printf ("Enter string 2:") scanf ("%s", s2); /7 Compare them int index 0; while (1) / Load characters from sl and s2 char c1 = s1 [index ]; char c2 = s2 [index ]; /1 Current character is greater for sl if (cl > c2) printf ("sl >s2 n") break; /1 Current character is greater for s2 if (cl

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!