C语言怎么删除字符串中的指定字符

如题所述

很高兴能回答你的提问`我是简单の快乐。 #include<conio.h>
#include<stdio.h>
void delspace(char * p)
{
int i,j=0;
for ( i = 0;p[i]!='\0';i ++ ) {
if(p[i] != ' ')
p[j++] = p[i];
}
p[j] = '\0';
}
void main()
{
char s[100];
printf("Please input the string!\n");
gets(s);
delspace(s);
puts(s);
getch();
温馨提示:答案为网友推荐,仅供参考
相似回答