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
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
Trending Articles/News
What After MBA CET Result 2025?
9 minutes ago