0
dynamic memory
how we allocate dynamic memory ?
5 Respostas
+ 3
hinanawi It's not considered good practice to manually allocate and deallocate memory with those functions. C++ best practice to use smart pointers like unique_ptr and shared_ptr
+ 1
malloc/free/realloc in C++ must be used ONLY for raw memory allocation while for objects you have to use new/delete
0
for memory manipulation you would use malloc(), realloc(), and free(), if that's your question.
0
ok thanks
0
Actually i want help in program which consists of a class Pyramid. The class should contain a static data member “Pcount” which stores the total number of Pyramid’s objects.
In the main() function, dynamically create three objects of Pyramid class and print the value of “Pcount”. Afterwards, delete any two objects of Pyramid and print the value of “Pcount” again. Can anyone help me with coding .