+ 4
can I use malloc() function of C language to allocate dynamic memory in c++?
tell the answer about this question Yes/no:-
2 Respostas
+ 6
As a matter of fact, yes. But I don't recommend using it in conjunction with C++ code. If you use malloc to initialize an object or struct, the object's constructor is not automatically called, whereas if you use the "new" keyword, it is.
0
Whatever you do don't mix them. A new needs a delete and a malloc a free