What if one forget the [] when deleteing array allocated , C/C++ Programming

What if one forget the [] when deleteing array allocated through new T[n]?

A: All life comes to a disastrous end.

It is the programmer's responsibility not the compiler's to get the connection among new T[n] and delete[] p correct. If you get it incorrect, neither a compile-time nor a run-time error message will be generated through the compiler. Heap corruption is a likely result. Or worse. Your program will die probably.

 

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







Related Discussions:- What if one forget the [] when deleteing array allocated , Assignment Help, Ask Question on What if one forget the [] when deleteing array allocated , Get Answer, Expert's Help, What if one forget the [] when deleteing array allocated Discussions

Write discussion on What if one forget the [] when deleteing array allocated
Your posts are moderated
Related Questions

Program to Open a file in C++: int main() {                  char ch;                  ifstream f1 ("OLDFILE.TXT");                  ofstream f2 ("NEWFILE.TXT");

Structure of C++ Program: Chronological order of C++ program. 1.   Class declaration 2.   Main function program 3.   Member functions definitions 4.   Include heade

Differentiate between the expression "++a" and "a++"? - With ++a, increment happens first on variable a, and resulting value is used. This is known as prefix increment. - Wi

Hi, Can i get a quote for my Programming assignment

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t


A: No. (Excluding if you have an old compiler, you might have to force the new operator to throw an exception if it runs out of memory.) This turns out to be a real pain to alwa

for object, malloc allocates memory in heap however doesn't invoke object's constructor to initialize the object. new allocates memory & also invokes constructor to initialize the

.Develop a two dimensional interactive game with the following features: 1. Use OpenGL (any version you find convenient) 2. The game can either be two player or one player with the