Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Difference between delete and delete[]?

Answer Posted / sachin mahajan

When we want to free a memory allocated to a pointer to an
object then "delete" is used.
Ex
int * p;
p=new int;
// now to free the memory
delete p;
But when we have allocated memory for array of objects like
int * p= new int(10); //pointer to an array of 10 integer
then to free memory equal to 10 integers
delete []p;
NOTE: One can free the memory even by "delete p;" But it
will free only the first element memory.


Is This Answer Correct ?    70 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Array base access faster or pointer base access is faster?

2358


What is the role of static keyword for a class member variable?

1114


What is a node class in c++?

1114


How long it will take to learn c++?

1101


Can union be self referenced?

1215


Can static member variables be private?

1240


Will the following program execute?

1073


Is recursion allowed in inline functions?

1132


What is the difference between function overloading and operator overloading?

1171


What is the benefit of learning c++?

1044


How would you implement a substr() function that extracts a sub string from a given string?

1104


What is the difference between struct and class?

1652


What is the best c c++ compiler for windows?

1102


What are the steps in the development cycle?

1160


What is c++ in english?

1118