c/language/operator logical

Logical operators apply standard boolean algebra operations to their operands.

Logical NOT
The logical NOT expression has the form

where

The logical NOT operator has type. Its value is if  evaluates to a value that compares unequal to zero. Its value is if  evaluates to a value that compares equal to zero. (so is the same as )

Logical AND
The logical AND expression has the form

where

The logical-AND operator has type and the value  if both  and  compare unequal to zero. It has the value otherwise (if either  or  or both compare equal to zero).

There is a after the evaluation of. If the result of compares equal to zero, then  is not evaluated at all (so-called short-circuit evaluation)

Logical OR
The logical OR expression has the form

where

The logical-OR operator has type and the value  if either  or  compare unequal to zero. It has value otherwise (if both  and  compare equal to zero).

There is a after the evaluation of. If the result of compares unequal to zero, then  is not evaluated at all (so-called short-circuit evaluation)