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 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
Get step-by-step solutions from verified subject matter experts
