I have written this simple C code,
int *p = NULL;
if (p && *p);
//if (*p && p);
The && operator has short-circuit evaluation. If the result can be determined by just looking at the value of the left operand, then the right operand is not evaluated. For the && operator, this means that if the left side evaluates to false, it doesn't evaluate the right side, and the result is false. In other words,
if (p && *p) ...
is equivalent to
if (p) if (*p) ...
From the C11 standard, section 6.5.13/4:
Unlike the bitwise binary & operator, the && operator guarantees left-to-right evaluation; if the second operand is evaluated, there is a sequence point between the evaluations of the first and second operands. If the first operand compares equal to 0, the second operand is not evaluated.