2025-02-25 01:22:28
/*
删除数字字符前:asshgeytwg45098863hdh11
删除数字字符后:asshgeytwghdh
Press any key to continue
*/
#include <stdio.h>
void DelNum(char s[],char ch) {
int i,j;
for(i = 0; s[i]; ++i) {
if(s[i] == ch) {
for(j = i; s[j]; ++j)
s[j] = s[j + 1];
--i;
}
}
}
int main(void) {
char c,s[] = "asshgeytwg45098863hdh11";
printf("删除数字字符前:%s\n",s);
for(c = '0'; c <= '9'; ++c)
DelNum(s,c);
printf("删除数字字符后:%s\n",s);
return 0;
}
大哥 是数组字符 不是数字字符 好像这两个不是一个概念吧 你试试编一个删除数组字符的 会吗??
char 数组中存储的数字就是数字字符('0','1',......,'9'),没有“数组字符”的说法。
2025-02-25 02:51:48