While declaring all c++ pointer, all should by default be initilized to ZERO or NULL to avoid any random unwanted values. So that we can check if pointer is null that means not initilized.
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In C++03, prefer
ptr = 0overptr = NULL(Bjarne S. says that. Read the excerpt below quoted from his site)In C++0x,
ptr = nullptr(see this)Bjarne Stroustrup says that,