When I run the program, the numbers I'm getting are completely ridiculous such as -39389014 when the number in the text file is 20. Here is what my text file looks like:
20 20
40 30
80 40
90 20
60 10
18.0
And the Code:
#include <stdio.h>
#define SIZE 5
int main(void){
FILE *in = fopen("pfile1.txt", "r");
int x[5], y[5], i;
double h;
for (i=0;i<SIZE;++i){
fscanf(in, "%d %d", &x[i], &y[i]);
}
for (i=0;i<SIZE;++i){
printf("%4d %10d\n", x[i], y[i]);
}
fscanf(in, "%lf", &h);
printf("%lf\n", h);
fclose(in);
return(0);
}