求助:栈溢出怎么解决
程序代码:
#include <stdio.h> int LOC; int recurbinary(int *a,int key,int low,int high){ int mid,flag=1; mid=(low+high)/2; if(mid==low+1){ if(a[low]==key){ LOC=low; return 1; } flag=0; } if(mid+1==high){ if(a[high]==key){ LOC=high; return 1; } flag=0; } if(a[mid]==key){ flag=0; LOC=mid; return 1; } if(recurbinary(a,key,low,mid) && flag) recurbinary(a,key,mid,high); } int main(){ int a[]={1,8,6,4,2,3,7,5,9}; recurbinary(a,3,0,8); printf("LOC=%d\n",LOC); return 0; }
在执行过程中只出现Press any keys to continue。调试中出现栈溢出。怎么回事?