118 Views

Why in c++ programming new operater used


Ankit kumar yadav 3rd Nov, 2018
Answer (1)
Debosmitha Bhattacharyya Student Expert 4th Nov, 2018

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

MAHE Bengaluru Law 2025
Apply
Accorded Institution of Eminence by MoE, Govt. of India | NAAC A++ Grade | Ranked #4 India by NIRF 2024
Chandigarh University Admissi...
Apply
Ranked #1 Among all Private Indian Universities in QS Asia Rankings 2025 | Scholarships worth 210 CR
MAHE Bengaluru BBA/ IPM 2025
Apply
Top Business School accredited by AACSB & AMBA | Ranked #4 by NIRF, NAAC A++ Accredited
TAPMI MBA 2025 | Technology M...
Apply
MBA Admission Open in Technology Management and AI & Data Science | NAAC A++ | Institution of Eminence | Assured Scholarships
Sanskriti University LLM Admi...
Apply
Best innovation and research-driven university of Uttar Pradesh
Maya Devi University LLM admi...
Apply
43.6 LPA Highest Package | 5.48 LPA Average Package | 150+ Courses in UG, PG, Ph.D
View All Application Forms

Download the Careers360 App on your Android phone

Regular exam updates, QnA, Predictors, College Applications & E-books now on your Mobile

150M+ Students
30,000+ Colleges
500+ Exams
1500+ E-books