知道这个程序有错误,但不知道怎么改

# include <stdio.h>

# include <conio.h> 

void fun ( char * s )

{

int i , j ;

for (i=0,j=0; s [i]!='\0'; i ++)

if ( s[i]>='0'&& s[i]<='9')

s[j ]= s[i] ;

s[j ]="\0";

main () 

{

char item [80];

clrscr();

printf("\nEnter a string :");

gets(item);

printf("\n\nThe string is:%s\n",item);

fun(item);

printf("\n\nThestring of changing is:%s\n",item);

}

#include <stdio.h>
#include <conio.h>
void fun(char *s)
{
    int i, j;
    for (i = 0, j = 0; s[i] != '\0'; i++)
        if (s[i] >= '0' && s[i] <= '9')
            s[j++] = s[i];
    s[j] = '\0';
}

void main()
{
    char item[80];
    printf("\nEnter a string :");
    gets(item);
    printf("\n\nThe string is:%s\n", item);
    fun(item);
    printf("\n\nThestring of changing is:%s\n", item);
}

 

 

 

# include <stdio.h>

# include <conio.h> 

void fun ( char * s )

{
int i , j ;

for (i=0,j=0; s [i]!='\0'; i ++)

if ( s[i]>='0'&& s[i]<='9')

    s[j++]= s[i] ;

s[j ]='\0';

} 

void main () 

{
char item [80];

clrscr();

printf("\nEnter a string :");

gets(item);

printf("\n\nThe string is:%s\n",item);

fun(item);

printf("\n\nThestring of changing is:%s\n",item);

}

 

j忘记j++了吧

而且\0应该是单引号