iamcodylee
2010-09-15 01:40:48 UTC
int i=0,j;
int l,h=0;
char *shuzu[8];
char str1[]="CTU,PEK,319,CTU,PEK,321,CTU,PEK,321";
token=strtok(str1,",");
while(token!=NULL )
{
if(strlen(token)==3)
{
//printf("%s\n ",token);
shuzu[i]=token;
i++;
}
token=strtok(NULL,",");
}
for(j=0;j{
//printf("%s\n",shuzu[j]);
for (l=j;l<=i;l++)
{
if (shuzu[l]==shuzu[j])
{
shuzu[j]="none";
}
}
}
Above is my codes, but I just don't understand why the array eventually turn into NONE, I'm trying to figure out the unique values in the array. who can give me a hand?
any help would be appreciated!!!