Logical Operators

Logical NOT
Reverses the truth value of a variable or expression.

Logical AND
Tests if two expressions are both true. If the first expression is false, then the second expression is not evaluated (see Comments below).

Logical OR
Tests to see if at least one of two expressions is true. If the first expression is true then the second expression is not evaluated (see Comments below).

Syntax
!x

x && y

x || y

Comments
Since the second operand in a logical expression is not necessarily evaluated, you can write code with perhaps unintuitive results. For example :-

if (x && y++) function;

If x is ever false (zero) then not only is function not called but y is not incremented. If you intend to increment y regardless of the value of x, you should do so outside of the Logical AND expression.

Similarly :-

if (x || y++) function;

If x is ever true (non-zero) then although function is called y is not incremented. If you intend to increment y regardless of the value of x, you should do so outside of the Logical OR expression.