Hello, i know this error message was asked many times but if you're a newbie you can't even understand what's going on. This code gives that error, any help would be appreciated, thanks...
Code:#include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <conio.h> #define SIZE 64 void fill_array(int[]); void display_array(int[]); int binary_search(int[],int); void bubblesort(int[]); int main() { int array1[SIZE], number, i; srand(time(NULL)); fill_array(array1); bubblesort(array1); display_array(array1); printf("Enter what you are looking for: "); scanf("%d",&number); i = binary_search(array1, number); if(i>=0) printf("The element you are looking for is %d and its in %d. location",array1[i],i); else printf("The element you are looking for is not in array"); getch(); system("Pause"); return 0; } void fill_array(int my_array[]) { int j=0; for(j=0;j<SIZE;j++) { my_array[j]=rand()%100; } } void display_array(int my_array[]) { int k = 0; for(k=0;k<SIZE;k++) { printf("%5d",my_array[k]); if(((k+1)%8)==0) printf("\n"); } } void bubblesort(int my_array[]) { int i, j, temp; for(i=1;i<=(SIZE-1);i++) { for(j=0;j<=(SIZE-2);j++) { if(my_array[j]>my_array[j+1]) { temp=my_array[j]; my_array[j]=my_array[j+1]; my_array[j+1]=temp; } } } } int binary_search(int my_array[],int num) { int middle, high, low, flag = -1; high = SIZE-1; low = 0; while(high >= low) { middle =(int)((high+low)/2); low = middle+1; if(num<my_array[middle]) high=middle-1; if(num==my_array[middle]) { return(middle); } } return (flag); }



LinkBack URL
About LinkBacks
. This code gives that error, any help would be appreciated, thanks...



thank you GL.Sam