113 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

UPES Integrated LLB Admission...
Apply
Ranked #28 amongst Institutions in India by NIRF | Ranked #1 in India for Academic Reputation by QS University Rankings | 16.6 LPA Highest CTC
Jindal Global Law School Admi...
Apply
Ranked #1 Law School in India & South Asia by QS- World University Rankings | Merit cum means scholarships | Application Deadline: 30th Nov'24
Chandigarh University Admissi...
Apply
Ranked #1 Among all Private Indian Universities In QS Asia Rankings 2025 | Scholarships worth 210 CR
Great Lakes PGPM & PGDM 2025
Apply
Admissions Open | Globally Recognized by AACSB (US) & AMBA (UK) | 17.3 LPA Avg. CTC for PGPM 2024 | Application Deadline: 1st Dec 2024
ICFAI Business School-IBSAT 2024
Apply
9 IBS Campuses | Scholarships Worth Rs 10 CR
Nirma University Law Admissio...
Apply
Grade 'A+' accredited by NAAC
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