3 ms·
Interesting C++ tidbit: the ternary operator can yield an lvalue, like so: int foo = 0, bar = 0; (cond ? foo : bar) = 8; This doesn't work in plain C.
by msarnoff 15y ago
Interesting C++ tidbit: the ternary operator can yield an lvalue, like so:
int foo = 0, bar = 0;
(cond ? foo : bar) = 8;
This doesn't work in plain C.
- koenigdavidmj 15y agoBut it does with pointers in C: int foo = 0, bar = 0; *(cond ? &foo : &bar) = 8;