When reading characters from standard input what does it mean when you are asked to sop on hitting EOF in the input?
Majoni 0 Newbie Poster
Recommended Answers
Jump to Post> char ch = getchar();
It should be
int ch = getchar();char holds all possible chars. To hold all possible chars and EOF, you need a bigger data type, thus int.
Nor is the returned value guaranteed to be -1, which is why there is a constant …
All 7 Replies
Aia 1,977 Nearly a Posting Maven
Majoni 0 Newbie Poster
Aia 1,977 Nearly a Posting Maven
Majoni 0 Newbie Poster
Salem 5,265 Posting Sage
Aia commented: right! +2
dwks 149 Posting Whiz in Training
Aia commented: Good information help. +3
gourav1 -12 Posting Whiz in Training
WaltP commented: I'm certainly glad we waited 5 years for you to give your approval to this ancient piece of information... -4
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.