Write a function inOrder that takes three string (char*) arguments. The function
ID: 3631241 • Letter: W
Question
Write a function inOrder that takes three string (char*) arguments. The function combines the first two strings, in alphabetical order, and stores the result in the third string. No spaces or other characters are added in between the strings.You may use functions from <string.h> in this function. You might consider strcmp, strcat, strcpy.
Example: If string1 is "zoom", string 2 is "abc", then string3 contains "abczoom" after your function returns.
The function has no return value. Assume that the third string is large enough to hold the all the characters from the other two strings.
-Thank You
Explanation / Answer
#include #include void function(char *str1,char *str2,char *str3) { for(int i=0;str1[i]!='' || str2[i]!='' ;i++) { if(str1[0]str2[0]){ str3= strcpy(str3,str2); str3= strcat(str3,str1); printf(" %s",str3); return; } } if(strlen(str1)Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.