从字符串中挑出数字,为什么不对
#include<stdio.h>#include<string.h>
void main()
{ void pick(char *s,int number[]);
char s[20];int number[20]={0};int i;
printf("please input a string:\n");
scanf("%s",s);
pick(s,number);
printf("the string is %s\n",s);
printf("the number is:\n");
for(i=0;number[i]!=0;i++)
printf("%d",number[i]);
}
void pick(char *s,int number[]);
{
char *p;
p=s;
char *q;int n=0;int *t=number;
q=p;
while(*p!='\0')
{ while(!(*p>='0'&&*q<='9'))p++;
q=p;
while(*q>='0'&&*q<='9')
{n=(n+*q-'0')*10;q++;
}
n/=10;*t=n;t++;p=q;
}
}