Answered step by step
Verified Expert Solution
Question
1 Approved Answer
here is some code for your convenience #include #include #define SIZE 30 int main(){ char a[SIZE]; char b[SIZE]; char c[SIZE]; char d[SIZE]; scanf(%s,a); scanf(%s,b); while
here is some code for your convenience
#includeA Implementation Download file . This program reads two words (strings with no spaces) from the user, stored them into arrays a and b. It then copies the inputs into another two arrays c and d, using library function strcpy. Then it calls strcat to concatenate a and b, and calls my_strcat to concatenate c and d. If implemented correctly, a and c should have the same content. The program terminates when user enters two xxx. Implement function void my_strcat(char []). Obviously, function should not call library function strcat. Also should not create temporary arrays. Complete the while loop so that it keeps on prompting the user for inputs, and terminates when both two input strings are xxx, as shown in the sample output. You are encouraged to use strcmp library function to check the termination condition. 5.3 sample input, output (assume each input has less than 20 characters and contains no space.) red 118 $ a.out hello worlds strcat: helloworlds mystrcat: helloworlds good ok strcat: goodok mystrcat: goodok hi#include #define SIZE 30 int main(){ char a[SIZE]; char b[SIZE]; char c[SIZE]; char d[SIZE]; scanf("%s",a); scanf("%s",b); while ( ){ strcpy(c,a); strcpy(d,b); strcat(a,b); mystrcat(c,d); printf("strcat: %s ", a); printf("mystrcat: %s ", c); } } void my_strcat(char a[], char b[]){ }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started