Monthly Archives: February 2016

Nonzero in C

Everyone’s favourite is-nonzero “operator” in C (evaluating to 0 for an input of zero, or 1 for non-zero) is of course:

!!a

However if you don’t like that, this also works fine:

a && 1

This amuses me for some reason.