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

Am pass the 10000 records to target in target I will take commit interval 15000 when I was stop the work flow what will happened

0 Answers  


Will a C compiler always compile C++ code a) Yes b) No c) Only optimized compilers

0 Answers  


What is volatile and pragma? When they are used?

1 Answers  


Explain 'this' pointer and what would happen if a pointer is deleted twice?

0 Answers   Genpact,


Enter n no. of element and delete value from desire position

1 Answers  






Can c++ do everything c can?

0 Answers  


What is iterator c++?

0 Answers  


Is swift better than c++?

0 Answers  


What is the difference between public and private data members?

0 Answers  


We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?

0 Answers  


What is function overriding?

1 Answers  


int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}

0 Answers  


Categories