I have made a few changes to this program but I still dont understand it. Can someone help me please. I am also having problems with the two files, they are saved as dat files and I cannot input numbers into the files.
Thanks for your time
#include<stdio.h>
int main ()
{
FILE *fi;
FILE *fo;
fi = fopen("infile.dat","r");
fo = fopen("outfile.dat","w");
{
FILE *fi; /* input file pointer */
if ( (fi=fopen("infile.dat","r")) == NULL ) {
printf("ERROR opening file!\n");
return 1; /* terminates program in error */
}
{
int i;
int a[10] = { fi };
int max = a[0];
int min = a[0];
for (i = 0; i < 10; i++)
}
{
if (a[i] > max)
{
max = a[i];
}
else if (a[i] < min)
{
min = a[i];
}
}
fprintf (fo,"Maximum : %d\n", max);
fprintf (fo,"Minimum : %d\n", min);
fclose(fo);
fclose(fi);
return 0;
}
}