On 9/14/2017 at 10:45 AM, alvaro said:
Except that code doesn't find "abac" in the string "ababac". Correctness matters.
I thought it was odd that there was only one loop! Regardless, it was my intention to show that he's mostly poking around in the dark.
On 9/14/2017 at 10:59 AM, MarcusAseth said:
lol
Edit: since my lol above was downvoted, I realize it is kind of ambigous and possibly gives the wrong impression of what I laughed about, to put it in context: : it was because the other day I was saying to @h8CplusplusGuru that in my opinion the benefit of the forum was that anyone can correct each other and be corrected so that who's learning has more chance to get the correct informations. My lol was on the lines of "I knew it!"/"I said it"- don't hate pls 
I think the first line of what I had said was that forums such a gamedev are always around.
//take two char* (strings) and return char* to first occurence of second string
char* findx(char* str, char* strx ) {
if (!str || !strx) return nullptr;
for (int s = 0; str[s] != '\0'; s++) {
if (str[s] != strx[0]) continue;
char* found = &str[s];
int x = 0;
for ( x=1; strx[x] != '\0' && str[s + x] != '\0'; x++) {
if (str[s + x] != strx[x])
break;
}
if (strx[x] == '\0') return found;
}
return nullptr;
}
Anyways, If you ever need a flashlight =)