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

What is ctime c++?

0 Answers  


Explain how we implement exception handling in c++?

0 Answers  


What are class and object in C++?

1 Answers  


reading material is provided 3 books for c++ if u need more do let me know thnx i hve lots of material do let me know if u want it

2 Answers  


What are punctuators in c++?

0 Answers  






What is an iterator class in c++?

0 Answers  


What is a pure virtual function? Why is it represented as = 0...how is the internal implementation for the same

3 Answers   CTS,


Which of the following operator cannot be overloaded?

2 Answers   TCL,


What c++ is used for?

0 Answers  


template<class T, class X> class Obj { T my_t; X my_x; public: Obj(T t, X x) : my_t(t), my_x(x) { } }; Referring to the sample code above, which one of the following is a valid conversion operator for the type T? a) T operator T () { return my_t; } b) T operator(T) const { return my_t; } c) operator(T) { return my_t; } d) T operator T (const Obj &obj) { return obj.my_t; } e) operator T () const { return my_t; }

1 Answers   Quark,


What is the main use of c++?

0 Answers  


Explain the difference between struct and class in terms of access modifier.

0 Answers  


Categories