Question about while(!EOF)

OF is only an integer constant. On most systems it is -1. !-1 is false and while(false) won’t do anything.

What you want is to check the return values of scanf. scanf returns the number of successfully read items and eventually EOF.

Leave a Comment