谁能解析vc++6.0怪现象?
同一c文件,在win-tc上调试输入66,输出是0;在vc++6.0上调试输入66,输出7;为什么会是这样???该c文件是[gg.c],内容是:#include<stdio.h>
#include<conio.h>
int fun(int a[],int n,int x)
{
int i,j,mid,k=-1;
i=0;j=n;
while(i<=j)
{
mid=(i+j)/2;
if(x>a[mid])
i=mid+1;
else if(x<a[mid])
j=mid-1;
else if(x==a[mid])
{k=mid;break;}
}
return(k+1);
}
main()
{
int i,l,a[6]={2,5,6,8,9,10};
for(i=0;i<6;i++)
{
printf("%d ",a[i]);
}
scanf("%d",&l);
l=fun(a,6,l);
printf("\n%d\n",l);
getch();
}