130 Views
Why in c++ programming new operater used
Answer (1)
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.
Related Questions
learning of programming languages
116 Views
Chandigarh University Admissi...
Apply
Ranked #1 Among all Private Indian Universities in QS Asia Rankings 2025 | Scholarships worth 210 CR
Amity University Noida B.Tech...
Apply
Among Top 30 National Universities for Engineering (NIRF 2024) | 30+ Specializations | AI Powered Learning & State-of-the-Art Facilities
Shoolini University Admission...
Apply
NAAC A+ Grade | Ranked No.1 Private University in India (QS World University Rankings 2025)