求题解,查找数组中的下标
#include "stdio.h"void main()
{
int a[11]={5,13,19,21,37,56,64,75,80,88,92},x,low,high,mid,t=0; /*t是标志*/
printf("input search x: ");
scanf("%d",&x);
low=0;
high=10;
while(t==0&&low<=high)
{
mid=(low+high)/2;
if(x==a[mid])
{
t=1;
break;
}
else if(x<a[mid])
high=mid-1;
else
low=mid+1;
}
if(t)
printf("%d\n",mid);
else
printf(" no data!\n");
}
哪位帮解答下红字里t的作用是什么,谢谢。