Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!