Hello.
I am new to this website. I just had a quick question regarding the matter of EOF.
When I execute the program, the "main" function does not print "smalest" number, but rather prints some weird numbersCode:#include <stdio.h> #include <limits.h> int average (int smallest); int main (void) { // int n; int small; // int largest; average (small); printf("In main, smallest is: %d\n", small); return 0; } int average (int smallest) { int n; int largest; smallest = INT_MAX; largest = INT_MIN; printf("Please enter positive integers (EOF to stop): \n"); while(scanf("%d", &n) != EOF) { if (n < smallest) smallest = n; if (n > largest) largest = n; if (n < 0) { printf("\nERROR!"); printf("\nYou have either entered a negative integer \nor the integer you entered is too long.\n"); exit(0); } } printf("Smallest number is: %d\n", smallest); printf("Largest number is: %d\n", largest); return average; }