What is the use of new operator?

What is the use of new operator?

In C++ New Operator used to allocate the memory for the object on HEAP. It allocates the memory of size equal to the object of size, The new operator will return NULL or throw an exception on failure. 
             It provides dynamic storage allocation. Its syntax for an allocation expression containing the new operator is:

>>-+----+--new--+---------------------+--+-(--type--)-+--------->
   '-::-'       '-(--argument_list--)-'  '-new_type---'
 
>--+-------------------------+---------------------------------><
   '-(--+---------------+--)-'
        '-initial_value-'
 
 

By:umang
Date:2001-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related C Subjective Links

C Subjective interview questions and answers for experienced and fresher