Relying on the short-circuiting behavior of || and && in C is a long-accepted idiom. It's practically the purpose of those operators.
https://en.wikipedia.org/wiki/Short-circuit_evaluation#Commo...
https://en.wikipedia.org/wiki/Short-circuit_evaluation#Commo...