By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,461 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Correct me where I am wrong.

P: 4
Dear all,
correct me where I am wrong.

EOF has no ASCII value.
It is a C defined constant of type int,with value -1.

consider the program

int main()
int c;

// getch();

how this program will terminate??(will it?)
Aug 27 '10 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 9,197
There have been several threads about this.

The value of EOF is irrelevant. The value of EOF is EOF. That is, if you use EOF in your code then your program is guaranteed to work. If you don't, then all bets are off.

EOF represents a value larger than any possible number of bytes in a file. That value is EOF. The fact that some compiler writer picked -1 is just interesting.
Aug 27 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.