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

Define pre-condition and post-condition to a member function in c++?

1084


what is COPY CONSTRUCTOR and what is it used for?

1021


What is a breakpoint?

954


What is late binding c++?

923


Explain the difference between c++ and java.

1055


Is c++ a good beginners programming language?

1010


When is dynamic checking necessary?

1041


What is wrapper class in c++?

1041


How do I run c++?

996


How can I disable the "echo" feature?

1088


Why is c++ still best?

929


How is static data member similar to a global variable?

1050


what is a reference variable in C++?

1152


What is #include iostream h in c++?

1090


By using c++ with an example describe linked list?

977