Do i require checking for null before delete p?, C/C++ Programming

No. it's not required

The C++ language guarantees that delete p will do nothing if p is equivalent to NULL. As you might get the test backwards, and as most testing methodologies force you for performs test explicitly every branch point, you should not put in the redundant if test.

Wrong:                    

if (p != NULL)

delete p; Right: delete p;

 

Posted Date: 3/19/2013 8:40:07 AM | Location : United States







Related Discussions:- Do i require checking for null before delete p?, Assignment Help, Ask Question on Do i require checking for null before delete p?, Get Answer, Expert's Help, Do i require checking for null before delete p? Discussions

Write discussion on Do i require checking for null before delete p?
Your posts are moderated
Related Questions
find the greater of the two variables, without using conditional loops or ternary operators?

Intelligent homes are becoming increasingly popular as the cost/performance ratio of microcontrollers is continuously dropping.  These systems incorporate various transducers to de

#A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrom

I am working on a program that allows a player to play a game against the computer. In this game the player can only chose to draw 1, 2, or 3 toothpicks. How do I make restrictions

create algorithm for doubly link list using c data structure

Define the Keywords of c language? C keeps a small set of keywords for its personal use. These keywords can't be used as identifiers in the program. Here is the list of keyword

Explain about the Expressions in c Language? An expression is the combination of constants, variables and operators arranged as per the syntax of the language. Some of the illu

Reference Types The symbol "&" is interpreted as an address operator as well as AND operator. This operator is also used to declare a "reference variable". A reference is refer

What is constructor or ctor? need help

submitting solutions in C language should not use functions from / as these files do not exist in gcc