code declaration for search string function

[code]/*check if sub-string s1 exists in string s. if yes, return the
pointer of first character of s that was matched. otherwise, return
null pointer. */
char *isFoundSubS(const char *s, const char *s1)
{
while (*s != 0) {
if (*s == *s1) {
register size_t i = 1;

for (; s1[i]; i++)
if (s[i] != s1[i])
break;
if (s1[i] == 0)
return (char *) s;
}
s++;
}
return 0;
}[/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories