#include #include #include int * a; int main(int argc, char * argv[]) { FILE * fptr; int c; int i; int count = 0; int found =0; int key; int sptr; fptr = fopen(argv[1], "r"); do {c = fgetc(fptr); if ( c == '\n') {count++;} } while (c != EOF); //printf("count:%d", count); a = malloc(sizeof(int)*count); //sptr = a; //holding start point position fclose(fptr); int low =0; int high = count; int middle = (low+high)/2; fptr = fopen(argv[1], "r"); //c = fgetc(fptr) for(i=0;ikey) {high = (middle-1); middle = (low+high)/2;} else {low = (middle +1); middle = (low+high)/2;} } while (found != 1); return EXIT_SUCCESS; }