difference between c++; and ++c;

Doug Gwyn gwyn at smoke.brl.mil
Sat Apr 13 07:18:37 AEST 1991


In article <3730 at inews.intel.com> bhoughto at nevin.intel.com (Blair P. Houghton) writes:
>>... it is nice to express what you mean as directly as possible.
>    i += 1;	"Increment i."

++i; is in every way equivalent, including the value that is ignored
of the expression in the expression-statement.  I know of no skilled
C programmer who writes i += 1 under normal circumstances, as ++i is
more directly expressive of the notion.

This doesn't matter a whole lot, other than that students of the
language should try to adopt an idiomatic style that fits into
established practice, to improve communication with co-workers.



More information about the Comp.lang.c mailing list