c must have type int for proper detection of EOF code example Example: how to check if you are at the end of an file while(!feof(stdin))