#include<stdio.h> void fun(char s[], char c); int main() { char str[50],c; gets(str); scanf('%c', &c); fun(str, c); return 0; }

void fun(char s[], char c) { int i, j; for (i = 0, j = 0; s[i] != '\0'; i++) { if (s[i] != c) { s[j++] = s[i]; } } s[j] = '\0'; if (j == i) { printf('%c not exist in\n', c); puts(s); } else { puts(s); } }

C语言函数实现字符串删除指定字符

原文地址: https://www.cveoy.top/t/topic/nYVe 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录