How do you allocate and deallocate memory in C++?



How do you allocate and deallocate memory in C++?..

Answer / hrpynux@gmail.com

Use the malloc() function to allocate memory in designated blocks and the new function to create a new function. To reallocate memory, the realloc() function is used. When finished, always include a free() function in order to free up the memory. If you used new(), use delete() to free up the memory.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D

1 Answers  


What is the arrow operator in c++?

0 Answers  


What is purpose of abstract class?

0 Answers  


What is Name Decoration?

2 Answers   Lucent,


What are advantages of c++?

0 Answers  






What is virtual table?

0 Answers  


Evaluate !(1&&1||1&&0) a) Error b) False c) True

0 Answers  


What are special characters c++?

0 Answers  


What are the stages in the development cycle?

0 Answers  


What is the best book for c++ beginners?

0 Answers  


Is it possible to provide special behavior for one instance of a template but not for other instances?

0 Answers  


What is polymorphism in c++? Explain with an example?

0 Answers  


Categories