Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What should.... ?

Name: Anonymous 2011-09-29 14:54

What should

a ? b = c : b = d

do?

Name: Anonymous 2011-09-29 15:17

>>1
If you're talking about C, the ternary ?: operator has lower precedence than assignment, so both of the assignments will be executed (in undefined order).  Then a will be evaluated and the expression will return the value of b = c if a is non-zero or b = d otherwise.  The assignment operator returns what was assigned, so the result of the expression will be either c or d.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List