指向指针的指针
在一组已经进行升序排列的字符穿中,用折半查找法找出第一个字符相同的字符串,并输出.main()
{
void strsa(char **,int);
char *arr[5]={"abc","acd","afc","bcd","bd"};
strsa(arr,5);
}
void strsa(char **array,int a)
{
int i,bot,top,j,k;
for (i=0;i<a;i++)
{
bot=i;
top=a-1;
while (top>bot)
{
j=(top+bot)/2;
if (*(array[i]+0)==*(array[top]+0))
{
k=top;
for(;k>bot;k--)
printf("The first letter of string %d as same as string %d", top,i);
bot=j;
}
else
top=j;
}
}
}
运行时怎么会是死循环呢?