What is the use of new operator?

Showing Answers 1 - 1 of 1 Answers

Sudhir

  • Sep 17th, 2007
 

"new"  is a Operator in C++ used to allocate the memory for the object on HEAP.
It allocates the memory of the size equal to the size of Object.If the specified Memory available on heap then it allocates memory and return pointer to that location as Successfull allocation of Memory.
But if the memory of specified size is not available on heap then it throws "bad_alloc" exception.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions