C语言一个字符串的问题

#include
#include
int main(){
char s1[81], s2[81];
scanf("%s", s1);
scanf("%s", s2);
char *find = NULL;
int len2 = (int)strlen(s2);
while ((find = strstr(s1, s2)) != NULL)
{
while ( *(find + len2) )
{
*find = *(find + len2);
find++;
}
*find = '\0';
}
puts(s1);
}


上面是关于s1中去除S2中的字符串 然后输出去除后的S1字符串.我看见别人这样做后可以成功得到结果 但是上面没有任何关于S1的操作.所以有疑问请教各位前辈1

怎么没有呢,strstr返回的就是s1的地址啊,在*find就是操作s1啊。

strstr函数的作用是找出字符串s2在字符串s1中第一次出现的位置,并返回该位置的指针,然后把s2原来 位置的值赋为0,最后输出

关键是 strstr 的用法,与返回值要理解

 int len2 = (int)strlen(s2);
while ((find = strstr(s1, s2)) != NULL)    // strstr 在 s1 中查找 s2,返回指针的值是 s1 + n,与 s1 是指向同一内存区域 
{
    while ( *(find + len2) )                     // 找到的位置指针 + s2 的长度,即跳过 s2 将后面的内容复制到找到的位置处。完成去除 s2 的目的!
    {
    *find = *(find + len2);
    find++;
    }
    *find = '\0';
}
puts(s1);

find就是s2在s1中出现的头的位置,第二个while里进行的是将s1中s2串后面的内容一个一个覆盖到原来s1中s2串的位置,
*就是去指针处的内容,覆盖完以后外层while里find=''\n''就是就是把后面的尾巴截掉,然后输出就是s1去掉s2以后的了。
示意图

说错了,find='\0'