#include <stdio.h>
void fun(char* a)
{
//***df**fr*fg***
int i = 0, j = 0,n=0,m=0;
char* p;
p = a;
while (p[i] != '\0')
{
i++;//i是一共的字符的个数
}
printf("%d\n",i);
while (a[n] == '*')
{
n++;//计算字母前的*的个数
}
printf("%d\n", n);
m = n;
for (j = n; j < i; j++)
{
if (p[j] != '*')
a[m++] = p[j];
}
a[m] = '\0';
}
void main(){
char s[81];
printf("Enter a string:\n"); gets(s);
fun(s);
printf("The string after deleted:\n"); puts(s);
}
输出的结果: