Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: K&R p.97 |
| Date | 2012-02-12 11:38 +1300 |
| Message-ID | <9po8ufFr4aU4@mid.individual.net> (permalink) |
| References | <ea85de45-665a-4098-ac47-e1771cc7b925@i2g2000vbv.googlegroups.com> <9po5asFr4aU3@mid.individual.net> <4709e3ec-3af3-4ae6-afc6-23e04d929fd2@db5g2000vbb.googlegroups.com> |
On 02/12/12 11:18 AM, Tom wrote: > On Feb 11, 9:36 pm, Ian Collins<ian-n...@hotmail.com> wrote: > >> Followed by a return. This function has done its job (extracting an >> integer from the stream) so it has to push the last character it read >> back into the stream. If it didn't, that character would be lost. > Yes, I see your point. Thank you. > > However, if the function is called using the for loop on p.96 then we > will see the behaviour I described, won't we? There isn't a loop on that page. But yes, if you where to blindly call the function without checking the result you would be in a loop. > The code that calls the function should account for a non-numerical > character, but it seems like the code on p.96 does not. The code is nothing more than a function to read an integer. Whatever calls it determines what to do next. -- Ian Collins
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
K&R p.97 Tom <t.scrace@gmail.com> - 2012-02-11 12:46 -0800
Re: K&R p.97 Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-02-11 13:25 -0800
Re: K&R p.97 Ian Collins <ian-news@hotmail.com> - 2012-02-12 10:36 +1300
Re: K&R p.97 Tom <t.scrace@gmail.com> - 2012-02-11 14:18 -0800
Re: K&R p.97 Ian Collins <ian-news@hotmail.com> - 2012-02-12 11:38 +1300
Re: K&R p.97 Tom <t.scrace@gmail.com> - 2012-02-11 14:44 -0800
Re: K&R p.97 Ian Collins <ian-news@hotmail.com> - 2012-02-12 14:34 +1300
Re: K&R p.97 Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-02-11 22:52 +0000
Re: K&R p.97 Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-02-11 17:09 -0500
csiph-web