int main()
{
int num_min = INT_MAX, num_max = INT_MIN, N;
char num_min_str[256], num_max_str[256];
FILE *fp;
if((fp=fopen("maxminvals","w")) == NULL)
{
printf("Unable to open a file for writing to\n");
return(-1); // exit the program
} // use -1 return value to indicate an error
// although that is pretty uneccessary here
// in this stand alone code
do
{
collect(&N); // send the address of the variable N to the function collect()
if (N < num_min) // on the first run through this loop
num_min = N; // num_min and num_max will both hold
if(N > num_max) // the same value of N
num_max = N;
printf("Minimum number is: %d, Maximum number is: %d\n",num_min,num_max);
}while (N!=0);
The rest of the main() function is in the next answer