在主函数中输入包含字符''的字符串,调用函数删除所有的,并输出。例如:
输入:“abcd12*56yu”,删除所有的“*”后输出:"abcd1256yu”
只需要将非*字符都移动到字符串开头位置
#include <stdio.h>
int main()
{
char s[1000];
int i=0,j=0;
gets(s);
while(s[i] != '\0')
{
if(s[i] != '*')
s[j++] = s[i];
i++;
}
s[j] = 0;
printf("%s",s);
}