面试题:删除字符串1中出现的字符串2的字符
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
static char *delete(char *string,char *del)
{
int i = 0;
int j = 0;
int k = 0;
char *p;
for(i=0;i<strlen(del);i++)
{
k=0;
for(j=0;j<strlen(string);j++)
{
if(*(string+j) != *(del+i))
{
*(string+k)=*(string+j);
k++;
}
}
*(string+k)='\0';
}
p=string;
return p;
}
void main()
{
char string[100] = {0};
char del[100] = {0};
char *p = NULL;
puts("\nput the string:\n");
gets(string);
gets(del);
p = delete(string,del);
printf(" after delete,the string is :%s\n",p);
}