Why in c++ programming new operater used
Hello Ankit,
The primary purpose of "new" operator is to allocate memory for a variable or an object during runtime. When new is used to allocate memory for a C++ class object, the object's constructor is called after the memory is allocated.
For example:
int * p2 = new int;
The new int part tells the program you want some new storage suitable for holding an operator uses the type to figure out how many bytes are needed. Then it finds the memory and returns the address.
Hope this helps. You can contact for any further guidelines.