jeudi 16 juin 2016

Does if (!(-1)) evaluate to true or false in C?

I know that 0 and NULL evaluate to FALSE on their own and I know that a negative integer or a positive integer evaluate to TRUE on their own.

My understanding is that the NOT operation will happen after evaluating the expression, so if (-1) will evaluate to TRUE, then applying the ! operand will mean NOT TRUE which equals FALSE. Is this the correct order of operations and is it correct that if (!(-1)) will evaluate to FALSE?

Aucun commentaire:

Enregistrer un commentaire