compare return value of scanf() with EOF to check if end of the file