指针指到我不行了
用指针数组给一些字符串排序 哪里出问题了啊# include <stdio.h>
# include <string.h>
void main()
{int i;
char *str[10]={"china","japan","yemem","pakistan","mexico","korea","brazil","iceland","canda","mongolia"};
char **p,**pt;char *t;
for(p=str;**p!='\0';p++)
for(pt=p+1;**pt!='\0';pt++)
if(strcmp(*p,*pt)>0)
{t=*p;*p=*pt;*pt=t;}
for(i=0;i<10;i++)
{p=str+i;
printf("%s\n",*p);}
}
昨天也是一个关于指针数组的问题 得到高手指教才顿悟 现在再次发帖 还是指针 这指针太让人揪心了