Actually that won't work, unless the string you're searching, is the string you're searching for. If you really want to know if a string is within a string... Open first with checking your String is not null, or your SearchString is not null; from there, if you actually want to know the SearchString is inside String, you should check each value of SearchString, to each value of String, before incrementing SearchString value... Otherwise, you're only checking for something that is identical... Also, you don't need so many brackets; it makes it look sloppy...
for (int i=0, s=0, e=strlen(Comp); i <= e; i++) {
if (Str[i] == 0x00 || Comp[i] == 0x00) return 0;
for (;s <= e;s++) {
if (Str[s] != Comp[i]) continue;
else break;
}
if (s != e && i != e) continue;
elseif ((int D = s - i) == e) return 1;
elseif (s == e || i == e) return 0;
}
Ok, so very quick, and it will not work entirely; it does not verify that each character is found in exact succession... However, it will probably do better then what you provided, and it does show a little bit more of the consolidation power of C... That and I just used spaces to indent... Keep in mind, C/C++ and php have the ability to inline; though it's not a wise choice to over use inlining, but it can make a lot of things easier...