/**
@author: Mathias Van Malderen (tux4life)
*/
const char *astrstr(const char *s1, const char *s2)
{
    for(; *s1; s1++)
    {
        for(int i=0; *s1 && *s2; s1++, s2++, i++)
        {
            if(!(*s1==*s2))
            {
                s1-=i;
                s2-=i;
                break;
            } else if(!(*(s2+1))) {
                return s1-i;
	    }
        }
    }
    return 0;
}

BTW, You can quickly adapt this code to C by just declaring i at the top of astrstr :)

Forgot to mention: The function behaves exactly as the normal strstr (so actually there was no need for a function like astrstr :P):
When the substring is found it returns a pointer to the beginning of that substring, otherwise, when the string you're searching for isn't found, it will return a NULL-pointer :)

You can change it return type from const char* to char* if there's need to, or you can overload the function.

You don't check whether s1 and\ or s2 are NULL pointers. If one of them is NULL, you'll get access violation \ segmentation fault exception.

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.