I have to create a function and a helper function to find a string inside a string and return the index location where it starts.
Example: "Absolution" and find "solution" inside it. It would return '2' as solution starts in index 2. Now, I can't use char* or substrings. My thought was to write a loop inside my first function with an if statement comparing the first letter, mystring2[0] of the second string to a letter in my first string, mystring1[i] and increment the index every loop. If it finds that the letters are a match, loop and keep comparing with the helper function and keep returning true if the letters keep matching until the end of the second string... I'm having trouble with implementation though. Any help would be appreciated. Here is my code for my first function:
1) You could use strtok() to split string b. The length of the first returned snippet would be the index in. I am not sure about dealing with the memory when using strtok() so you may wanna do some research.
2) otherwise, loop through the first, looking for matches in the 2nd, if found loop through 2nd to see if you have the whole world. If you get to j = length2 then you have a match. Return i