Ternary Operator Puzzle

By Susam Pal on 06 Apr 2011

What is the shortest statement you can write in the C or C++ programming language to express the following statement?

a = (a == 0 ? 0 : 1);

See the comments page for the solution.

Comments | #c | #programming | #technology | #puzzle