Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the program substring.c provided as boilerplate code to you. The boilerplate code specifies what the program needs to do. Program is compiled in C.

Complete the program substring.c provided as boilerplate code to you. The boilerplate code specifies what the program needs to do. Program is compiled in C.

#include  int main(int argc, char **argv) { const int BUF_LEN = 128; char haystack[BUF_LEN]; char needle[BUF_LEN]; char c; int i, j, substring, found; int needle_len, haystack_len; /* Get the user to enter two strings */ printf("Please enter a string, finishing the entry by pressing Enter. "); for (i=0; i 

Input/Output Examples:

$ ./substring Please enter a string, finishing the entry by pressing Enter. apple Please enter another string, finishing the entry by pressing Enter. applestrudle The strings you entered are "apple" and "applestrudle". "apple" is contained as a substring in "applestrudle". $ ./substring Please enter a string, finishing the entry by pressing Enter. adam Please enter another string, finishing the entry by pressing Enter. Madame Bovary The strings you entered are "adam" and "Madame Bovary". "adam" is contained as a substring in "Madame Bovary". $ ./substring Please enter a string, finishing the entry by pressing Enter.

Please enter another string, finishing the entry by pressing Enter. banana The strings you entered are "" and "banana". "" is contained as a substring in "banana". $ ./substring Please enter a string, finishing the entry by pressing Enter. banana Please enter another string, finishing the entry by pressing Enter. banana The strings you entered are "banana" and "banana". "banana" is contained as a substring in "banana". $ ./substring Please enter a string, finishing the entry by pressing Enter. oranje Please enter another string, finishing the entry by pressing Enter. Goranje The strings you entered are "oranje" and "Goranje". "oranje" is contained as a substring in "Goranje". $ ./substring Please enter a string, finishing the entry by pressing Enter. orange Please enter another string, finishing the entry by pressing Enter. Goranje The strings you entered are "orange" and "Goranje". "orange" is not contained as a substring in "Goranje".

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

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

More Books

Students also viewed these Databases questions

Question

=+ 2. What is the opportunity cost of seeing a movie?

Answered: 1 week ago

Question

=+ what roles should government play in them ?

Answered: 1 week ago

Question

=+ Why do we have markets and, according to economists,

Answered: 1 week ago