test passed Print the two strings in alphabetical order Assu

test passed Print the two strings in alphabetical order Assume the strings are lo End with newline. Sample output: wercase. capes rabbits 1 include 2 ,,include

Solution

#include <stdio.h>
#include <string.h>
int main()
{
char firstString[50];
char secondString[50];
strcpy(firstString, \"rabbits\");
strcpy(secondString, \"capes\");

if(strcmp(firstString, secondString) < 0){
printf(\"%s %s\ \", firstString, secondString);
}
else{
printf(\"%s %s\ \", secondString, firstString);
}

return 0;
}

Output:

sh-4.2$ gcc -o main *.c                                                                                                                                                                                                                                

sh-4.2$ main                                                                                                                                                                                                                                           

capes rabbits

 test passed Print the two strings in alphabetical order Assume the strings are lo End with newline. Sample output: wercase. capes rabbits 1 include 2 ,,include

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site