- 论坛徽章:
- 0
|
我写了一个程序,老是得不到正确结果
#include "stdio.h"
#define MAX_PATH =1000
main()
{ int stor[1000],i=0,j=0,k;
char *temp= NULL,*temp1= NULL,*temp2=NULL;
temp = (char *)malloc(1000 * sizeof(char));
temp1=(char *)malloc(1000* sizeof(char));
temp2=(char *)malloc(1000 * sizeof(char));
char *sour="123$sdfsfjk94893849#zncn^3iuwi3i884982 sjksdjf0909 =288sjiwuoqp1";
for (;*sour;sour++)
{ if (*sour>47 &&*sour<5
{ temp1=temp;
*temp++ =*sour ;
i++;
}
else if (i>0)
{
*temp='\0';
strcpy(temp2,temp1);
stor[j++]=atoi(*temp2);
i=0;
}
}
for (i=0;i<=j;i++)
printf("%d\n",stor[i]);
} |
|