130 Views

Why in c++ programming new operater used


Ankit kumar yadav 3rd Nov, 2018
Answer (1)
user-img
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 Manipal M.Tech 2025
Apply
NAAC A++ Accredited | Accorded institution of Eminence by Govt. of India | NIRF Rank #4
Graphic Era (Deemed to be Uni...
Apply
NAAC A+ Grade | Among top 100 universities of India (NIRF 2024) | 40 crore+ scholarships distributed
Indrashil University | B.Tech...
Apply
Apply for B.Tech | AICTE Aproved | UGC Recognized | International Collaborations for Global Edge | 100% Placement Assistance
JSS University Mysore BBA Adm...
Apply
NAAC A++ Accredited| Ranked #24 in University Category by NIRF
JSS University Noida MBA 2025
Apply
170+ Recruiters Including Samsung, Zomato, LG, Adobe and many more | Highest CTC 47 LPA
UPES B.Tech Admissions 2025
Apply
Ranked #42 among Engineering colleges in India by NIRF | Highest Package 1.3 CR , 100% Placements | Last Date to Apply: 29th May
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