question archive Test if a string is subset of another:A function string_contains()strlenExample=; char str2 =;the function call which takes pointers two strings as inputs and determines whether the first string is a subset of the second string
Subject:Computer SciencePrice: Bought3
Test if a string is subset of another:A function string_contains()strlenExample=; char str2 =;the function call
which takes pointers two strings as inputs and determines whether the first string is a subset of the second string. It returns the index in the second string where a match is found. If the first string is not a subset of the 2nd string, it should return -1. You are not allowed to use built-in functions (other than ()) for this task.
: If the two strings are defined like shown below,
char str1 "world"
"hello world"
string_contains(str1, str2) should return 6, i.e. the index of the location where the match is found. The function has the following prototype:
int string_contains(char * str1, char * str2);
It is from C language not C++.
Please use the given function prototype in the program.
Program should have user defined input.