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.
&&operator. But apparently first asking is easier than learning. Re. the 2nd variant (*p %% p): why do you expect a segfault? You invoke undefined behaviour; think about the meaning of the word undefined.