Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #17133

Re: K&R p.97

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: K&R p.97
Date 2012-02-12 10:36 +1300
Message-ID <9po5asFr4aU3@mid.individual.net> (permalink)
References <ea85de45-665a-4098-ac47-e1771cc7b925@i2g2000vbv.googlegroups.com>

Show all headers | View raw


On 02/12/12 09:46 AM, Tom wrote:
> Guys,
>
> On page 97 of K&R (2nd ed) there is a function called getint().
>
> I won't paste it here because I assume most people can look it up, but
> if you want me to I will.
>
> The 6th line of the body of the function is:
>
> ungetch(c) /* it's not a number */

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.

-- 
Ian Collins

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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