Hi i have a binary function search program where the user enters a index of numbers, then enters the number he wants to find. However my program wont compile and says the subscripted value is neither an array or pointer. Help me out please. Here is what ive got:
# include <stdio.h>
# include "genlib.h"
# include "simpio.h"
# include "stdlib.h"
# include "strlib.h"
# define c 33000
int bisearch(int nArray,int arraynum, int maxarray)
{
int ran,track,sort,sort2,num1,save,count,result;
count=0;
sort=arraynum;
sort2=sort;
while(num1!=0)
printf("whats the next integer");
num1=GetInteger();
{
nArray[arraynum]=GetInteger();
while(sort!=0)
if(nArray[arraynum]<nArray[arraynum-1])
{
num1=nArray[arraynum-1];
nArray[arraynum-1]=nArray[arraynum];
nArray[arraynum]=num1;
sort=sort-1;
arraynum=arraynum-1;
}
else
{
sort=sort-1;
}
arraynum=sort2;
sort2=sort2+1;
sort=sort2;
printf("%d",nArray[arraynum]);
arraynum=arraynum+1;
count=count+1;
}
printf("what is your number");
while(count!=0)
{
if(result==nArray[arraynum])
{
printf("the number is in index %d",arraynum);
break;
}
else
{
arraynum=arraynum-1;
count=count-1;
}
}
main()
{
int maxarray,arraynum,bin;
printf("whats is are the numbers you want for your index. Hit 0 to end.");
int nArray[c];
nArray[arraynum]=0;
arraynum=0;
bin=bisearch(arraynum,maxarray,nArray[arraynum]);
getchar();
}