in Technology by
What does it mean when a pointer is used in an if statement?

1 Answer

0 votes
by

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,

if ( p )
{
/*Run when valid address */
}
else
{
/*When NULL pointer*/
}

Related questions

0 votes
    I am reading through the documentation of UIResponder class and I came across the responder chain. Now it's ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 27, 2022 in Education by JackTerrance
0 votes
    What does it mean when company says “no physical exam”?...
asked Dec 31, 2020 in Health by Editorial Staff
0 votes
    If the change in weight vector is represented by ∆wij, what does it mean? (a) describes the change in weight vector ... (d) none of the mentioned Please answer the above question....
asked Sep 7, 2022 in Education by JackTerrance
0 votes
    Which operator can be used to access union elements if union variable is a pointer variable?...
asked Jan 18, 2021 in Technology by JackTerrance
+1 vote
    Which operator can be used to access union elements if union variable is a pointer variable in C Programming ?...
asked Nov 9, 2020 in Technology by JackTerrance
0 votes
    What do you mean by danglimg if statement…..in simple language Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    What is mean by 'src refspec master does not match any when pushing commits in Git?...
asked Jan 8, 2021 in Technology by JackTerrance
0 votes
    How does pointer arithmetic work?...
asked Jan 24, 2021 in Technology by JackTerrance
0 votes
    What does it mean by message blocking is active on iphone?...
asked Aug 6, 2022 in Technology by Editorial Staff
0 votes
    What do you mean by VPN? What does it contain?...
asked Dec 16, 2020 in Technology by JackTerrance
0 votes
    When I launch an instance on EC2, it gives me an option for t1.micro, m1.small, m1.large etc. There is a ... of what these terms mean? Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    very quick newbish question here... In the jquery-mobile docs, it says that Note that the refresh() ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    Can anyone tell me what does it mean to be a Business Analyst? Select the correct answer from above options...
asked Jan 10, 2022 in Education by JackTerrance
0 votes
    What does it mean to weave a literate statistical program? (a) Convert a program from S to python (b) ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    What happens when we invoke a method on a nil pointer?...
asked Nov 10, 2020 in Technology by JackTerrance
...