A simple question on expression
Bohdan Vlasyuk
bohdan@kivc.vstu.vinnica.ua
Fri Aug 31 01:22:00 GMT 2001
On Fri, Aug 31, 2001 at 03:22:41PM +0800, Jie Zhang wrote:
> I want to ask a simple question on expression.
[...]
> a = (a<4)?0:a++; /* 1 */
[...]
> Who can tell me why the two printfs print out different results?
that is obvious!
second expression ([1]) is undefined -- it expands to:
if (a<4)
a=0;
else
a=a++; /* 2 */
[2] is undefined -- i.e a can take whatever possible value after it.
Please, read K&R before asking such questions.
--
They finally got King Midas, I hear. Gild by association.
More information about the Gcc
mailing list