Why doesn't this one workCode:#include <stdio.h> int lines,i; double *t, *x, *P; int main(int argc, const char *const *argv) { if ( argc > 1 ) { FILE *file = fopen(argv[1], "r"); /* Get filename from command line. */ if ( file ) { int ch, prev = '\n' /* so empty files have no lines */, lines = 0; while ( (ch = fgetc(file)) != EOF ) /* Read all chars in the file. */ { if ( ch == '\n' ) { ++lines; /* Bump the counter for every newline. */ } prev = ch; /* Keep a copy to later test whether... */ } fclose(file); if ( prev != '\n' ) /* ...the last line did not end in a newline. */ { ++lines; /* If so, add one more to the total. */ } printf("lines = %d\n", lines); } else { perror(argv[1]); } } t = (double *) malloc (lines * sizeof(double)); x = (double *) malloc (lines * sizeof(double)); P = (double *) malloc (lines * sizeof(double)); { FILE *file = fopen(argv[1], "r"); if ( file ) { double temp1, temp2, temp3; for(i = 0; i < lines; i++) { fscanf(file, "%lf %lf %lf", &temp1, &temp2, &temp3); t[i] = temp1; x[i] = temp2; P[i] = temp3; fprintf(stderr, "%lf %lf %lf\n", t[i], x[i], P[i]); } fclose(file); } else { perror(argv[1]); } } return 0; }