Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c program char str 1 [ 7 5 ] ; char str 2 [ 7 5 ] ; / / reading two phrases as input

c program char str1[75];
char str2[75];
//reading two phrases as input from the user
gets(str1);
gets(str2);
//check if both the strigs are equal
if(strcmp(str1,str2)==0)
{
printf("Both phrases match");
}else if(strstr(str2,str1))
{
//check if str1 is the substring of str2
printf("Phrase one is found within phrase two");
}else if(strstr(str1,str2))
{
//check if str2 is the substring of str1
printf("Phase two is found within phrase one");
}else{
//When none of the above cases is true
printf("No matches");
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago

Question

Connect with your audience

Answered: 1 week ago