I\'ve done my programming exam in C yesterday. There was a question I could not answer, and even though I\'ve studied today I can\'t come up with a solution.
So we h
The statement
X = B != C ? A=(~C) - A-- : ++C + (~A);
is equivalent to
if(B != C)
X = (A = (~C) - (A--));
else
X = ++C + (~A);
So, the expression A = (~C) - (A--)
invokes undefined behavior. In this case nothing good can be expected.
That said, this is a faulty question and shouldn't be asked in an examination. Or it could be asked with multiple choice answers as long as one option states that the code will invoke undefined behavior.