#include void delcharfun(char *str, char ch); int main() { char ch, str[110]; scanf("%s", str); //读入字符串 getchar(); //读取回车符号 scanf("%c", &ch); //读入字符 delcharfun(str, ch); //删除 printf("%s\n", str); //输出删除后结果 return 0; } /* 请在这里填写答案 */ void delcharfun(char *str, char ch) { int i; while (*str != '\0' && *str != '\n') { if (*str == ch) { // Shift this array i = 0; while (*(str + i + 1) != '\0') { *(str + i) = *(str + i + 1); i++; } // End this string to avoid duplicates *(str + i) = '\0'; str--; // Because the string is shifted } str++; } }