[讨论]再请教一个指针问题
#include "stdio.h"#include "string.h"
void choicesort(char **p1,int num)
{char **p2,**temp,**temp2;
for(;p1<p1+num-1;p1++)
{ temp=p1;
for(p2=p1+1;p2<p1+num;p2++)
if(strcmp(*temp,*p2)>0)temp=p2;
**temp2=**p1;
**p1=**temp;
**temp=**temp2;
}
}
main(){int i;
char *list[]={"boy",
"girl",
"hacker",
"cracker","honker","xbox","blogger","vfp","qiaomu","pragrammer"};
choicesort(list,10);
for(i=0;i<10;i++)
printf("%s\n",list[i]);
getch();
}
//这是一个用指针数组和指向指针的指针的实现的对10个字符串排序,怎么在运行的时候没有结果呢?谢谢