之前有一篇写过删除字符串中的#
这篇回顾一下:
删除字符串中的*
步骤如下:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <ctype.h>
void proc(char* str);
int main()
{
char str[81];
system("CLS"); //<stdlib.h>
printf("Input a string : \n");
gets(str);
puts(str);
proc(str);
printf("Output string is : %s",str);
getch();
}
void proc(char* str)
{
char* s = str;
int i = 0;
while (*s)
{
if (*s != '*')
{
str[i++] = *s;
}
s++;
}
str[i] = '\0';
}