Explain the difference between 'operator new' and the 'new'
operator?
Answer Posted / richa
The term "operator new" is used incase when u are
overloading the global "new" operator.We can overload ne
operator just as any other operators i.e +,-,*,=etc.
The term "new operator" is used in case of dynamic
allocation of memory.When a variable is allocated memory
dynamically the new operator is used.
Eg:
int *p=new int;
//here p is pointer to integer.So in order to allocate
memory for it we have used the new operator.
| Is This Answer Correct ? | 15 Yes | 0 No |
Post New Answer View All Answers
What do nonglobal variables default to a) auto b) register c) static
Why do we use pointers in c++?
Is java the same as c++?
What is split a string in c++?
What is constructor and destructor in c++?
Can malloc be used in c++?
Show the declaration for a static member variable.
What is the difference between a reference and a pointer?
What causes a runtime error c++?
What are all predefined data types in c++?
What is an iterator class in c++?
What is virtual base class uses?
How to declaring variables in c++?
Explain all the C++ concepts using examples.
What is the best c++ book?