#include <stdio.h>
int zheban(int A[],int n,int k)
{
int low,high,mid;
low = 0;
high = n-1;
mid = (low + high)/2;
while(low<=high)
{
if(k<A[mid])
high = mid - 1;
else if(k>A[mid])
low = mid + 1;
else
return mid;
}
return -1;
}
int main()
{
int A[]={1,3,5,7,9,11,20,23,30,33};
int i;
i = zheban(A[],10,30);
printf("%d",i);
}
求助,不知道错在哪
12-21
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-09
715
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-09
1282
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-14
1054
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-31