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 class objects be passed as function arguments?

0 Answers   HCL,


What are the differences between a struct and a class in C++?

7 Answers   Amazon, Wipro,


What do the header files usually contains?

0 Answers  


what is pulse code modulation?

2 Answers   Wipro,


What is the use of namespace std in C++?

0 Answers   Hexaware,






Why is c++ a mid-level programming language?

0 Answers  


Explain the isa and hasa class relationships.

0 Answers  


What is data binding in c++?

0 Answers  


What are the different types of comments allowed in c++?

0 Answers  


What can I use instead of namespace std?

0 Answers  


What is the outcome of cout< a) 16 b) 17 c) 16.5

0 Answers  


how many trys can we write in one class

3 Answers   Cap Gemini,


Categories