What does the following program do Show the results for two
What does the following program do? Show the results for two sample inputs of your choice. #include void mystery1(char *, const char *); int main() {char string1[80], string2[80]; printf(\"Enter two strings:\"); scanf(\"%s%s\", string1, string2); mystery1 (string 1, string 2); printf(\"%s \ \", string 1);} void mystery1(char *s1, const char *s2) {while(*s1 !=\'\\0\') ++s1; for (;*s1 = *s2; s1++; s2++);/* empty statement */}
Solution
It concatenates string2 with string1.
In mystery function we go to end of string1 first and then start appending string2 contents to the string1.
result will be string1 contains the concatenated string of string1 and string2.
Examples:
Enter two strings:
John
Karter
JohnKarter
Enter two strings:
John
Oliver
JohnOliver
