difference between c++; and ++c;

Terry Heatlie - Sun UK - Tech Support terryh at ukcsd.uk.sun.com
Thu Apr 11 19:10:54 AEST 1991


In article <1991Apr11.011347.5136 at tkou02.enet.dec.com>,
diamond at jit345.swstokyo.dec.com (Norman Diamond) writes:
|> In article <3614 at texsun.Central.Sun.COM> terryh at ukcsd.uk.sun.com
(Terry Heatlie - Sun UK - Tech Support ) writes:
|> >|> >   i++;	  "Save the current value of i, increment i then discard
|> >|> >	   the value just saved"
|> >|> >   ++i;   "Increment i then discard the resulting value"
|> >|>     i += 1;	"Increment i."
|> >
|> >Of course the value of i+=1 is 1,
|> 
|> W       W    RRRR      OOOO     N   N     GGGGG
|> W   W   W    R   R    O    O    NN  N    G  G
|>  W W W W     RRRR     O    O    N  NN    G    G
|>   W   W      R   R     OOOO     N   N     GGGG
|>
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Guilty.  Try "1 more than i was to start with" 
|> >so this is really "increment i and discard the resulting value"
|> (Yes, but.)
|> --
|> Norman Diamond       diamond at tkov50.enet.dec.com
|> If this were the company's opinion, I wouldn't be allowed to post it.

Regards,
Terry Heatlie.

Disclaimer:  all my own work (except this disclaimer, which I nicked).



More information about the Comp.lang.c mailing list