本人小白一枚。自己笔记,欢迎大家提出意见一起学习。
代码如下
void check (char *str)
{
char newstr[1024]="0";
int i,j,f=0,h=0;
printf("%d\n",strlen(str));
for(i=0;i<strlen(str);i++){
for(j=i+1;j<strlen(str);j++){
if(str[i]==str[j]){
for(f=0;f<=h;f++){
if(str[i]==newstr[f]){
break;
}
}
if(f==h+1){
newstr[h]=str[i];
h++;
}
}
}
}
for(i=0;i<h;i++){
printf("%c",newstr[i]);
}
printf("\n");
printf("Hello world!");
}
对于很多因素其实没有考虑,按道理应该是返回一个字符串,这就要注意空间大小等一系列问题