difference between c++; and ++c;

Norman Diamond diamond at jit345.swstokyo.dec.com
Thu Apr 11 11:13:47 AEST 1991


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

>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.



More information about the Comp.lang.c mailing list