Question: Write a function in the C language that searches for the first occurrence of a substring within a string. If the substring is found, then

 Write a function in the C language that searches for the

Write a function in the C language that searches for the first occurrence of a substring within a string. If the substring is found, then the index corresponding to its starting location in the string is returned. If the substring is not found, -1 is returned. For example, search ("this is a test", "a t") should return the value 8. The following is a prototype of the function. int search(const char* string, const char* substring): Also write a main function that calls your search function several times, with several test cases. Include the test case that is shown above. Test your program on the web site http: //rextester.com

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!