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

How to avoid a class from instantiation?

8 Answers   Symphony,


Describe the main characteristics of static functions?

1 Answers  


Assume studentNames and studentIDs are two parallel arrays of size N that hold student data. Write a pseudocode algorithm that sorts studentIDs array in ascending ID number order such that the two arrays remain parallel.

0 Answers  


What is & in c++ function?

0 Answers  


What is lvalue?

0 Answers  






Is c++ built on c?

0 Answers  


why we cant create array of refrences

4 Answers  


What is a container class? What are the types of container classes in c++?

0 Answers  


Describe the syntax of single inheritance in C++?

0 Answers   Fidelity,


What is the difference between structures and unions?

0 Answers  


What are literals in C++?

0 Answers   Wipro,


What are the advantages of using typedef in a program?

0 Answers  


Categories