J Chen - 2011-03-07

Hi,

I am using Dev-C++ Version 4.9.9.2.
I am confused by the results from compiling the following two statements:

(A) x = 0 ? 2+5 : x=y;
(B) x = 1? 2+5 : x=y;

The variables x and y are declared as int and initialized.
For (A), there is no error message from compiling and executing.
However, for (B), the compiler showed the error message:

invalid lvalue in assignment.
I figured out that the compiler located the error at "x=y". But I
could not find any explanation for this.
Can anyone help? Thanks in advance.

--
JC