// 从字符串s1中寻找s2第一次出现的位置(不比较结束符NULL)
// if 0 == s2, then return s1
char* my_strstr(const char* s1, const char* s2)// look for the first s2 in s1
{
int k = 0;// compact with c
if (0 == s2 || '\0' == s2) return (char*) s1;// const char* converted to char*, and it is necessary
if (0 == s1 || '\0' == s1) return (char*) s1;
while ('\0' != *s1)
{
for (k = 0; *(s1+k)!='\0' && *(s1+k) == *(s2+k); ++k)// it is good
{
if ('\0' == *(s2 + k + 1))
return (char*) s1;
}
++s1;
}
return NULL;
}