Question
#include int main(void) { int i; char line1[80], line2[80]; void readLine(char buffer[]); printf(Type in string to be searched (up to 80 characters):); for (i =
#include
int main(void)
{
int i;
char line1[80], line2[80];
void readLine(char
buffer[]);
printf("Type in string to be searched (up to 80 characters):");
for (i = 0; i < 3; ++i)
{
readLine(line1);
}
printf("Type in string to be found (up to 80 characters):");
for (i = 0; i < 3; ++i)
{
readLine(line2);
}
return 0;
}
void readLine(char buffer[])
{
char character;
int i = 0;
do
{
character = getchar();
buffer[i] = character;
++i;
} while (character != ' ');
buffer[i - 1] = '\0';
}
This is my code so far, I now want to have the string in line2 be searched in the string in line1 and then make a new string containing all the words from line2 that were found in line 1. for example if line 1 was hello world my name is c and line2 was my name is, then the new string would contain my name is
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