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:


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

a && 1

This amuses me for some reason.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>