It is good habits to check the pointer in if condition before using it. It prevents code crashing. A pointer can be used in an if, while, for, or do/while statement, or in any conditional expression.
Let see an example code,