除了字符串前导和尾部的号外,将串中其他的号全部删除。
#include <stdio.h>
#include <conio.h>
void fun( char *a, char *h,char *p )
{
int i=0;
char *k=a;
while (k<h)
{
a[i]=*k;
k++;
i++;
}
while(k<p)
{
if(*k!='*')
{
a[i]=*k;
i++;
}
k++;
}
while (*k)
{
a[i]=*k;
i++;
k++;
}
a[i]='\0';
}
main()
{ char s[81],*t, *f;
int i,j;
printf("Enter a string:\n");
gets(s);
t=f=s;
t=f=s;
while(*t)t++;
t--;
while(t=='')t--;
while(f=='')f++;
fun(s, f, t);
printf("The string after deleted:\n");
puts(s);
}