c语言!!删除字符串s中所出现的与变量c相同的字符
求大神!!!!哪有问题~~#include<stdio.h>voidSqueeze(char*s,charc);voidmain(){chara[80],c;scanf(...
求大神!!!!哪有问题~~
#include <stdio.h>
void Squeeze(char *s, char c);
void main()
{
char a[80],c;
scanf("%s",a);
scanf("%c",c);
Squeeze(a,c);
printf("%s\n",a);
}
void Squeeze(char *s, char c)
{
int i,j=0;
for (i=0; *(s+i) !='\0'; i++);
{
if (*(s+i) != 'c')
{
*(s+j) = *(s+i);
j++;
}
*(s+j) = '\0';
}
} 展开
#include <stdio.h>
void Squeeze(char *s, char c);
void main()
{
char a[80],c;
scanf("%s",a);
scanf("%c",c);
Squeeze(a,c);
printf("%s\n",a);
}
void Squeeze(char *s, char c)
{
int i,j=0;
for (i=0; *(s+i) !='\0'; i++);
{
if (*(s+i) != 'c')
{
*(s+j) = *(s+i);
j++;
}
*(s+j) = '\0';
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询