This question has been really interesting since you not only find the specific char, and you should connect the char after it to the one in front of it.
The c ++ code is written as follow:
void del_char(char str[], char c)
{
int i = 0, j = 0;
while(str[i] != '\0')
{
if(str[i] != c)
{
str[j++] = str[i++];
}
else
{
i++;
}
}
str[j] = '\0';
}
char *del_substr(char *str, char *delstr)
{
char *p, *q;
char *src, *dst;
dst = src = str;
while(*src != '\0')
{
p = src;
q = delstr;
while(*p == *q && *q != '\0')
{
p++;
q++;
}
if (*q == '\0')
{
src = p;
}
else
{
*dst++ = *src++;
}
}
*dst = '\0';
return str;
}