+ 4

can I use malloc() function of C language to allocate dynamic memory in c++?

tell the answer about this question Yes/no:-

11th Jan 2017, 5:13 AM
omkar patil
omkar patil - avatar
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.
11th Jan 2017, 5:31 AM
DaemonThread
DaemonThread - avatar
0
Whatever you do don't mix them. A new needs a delete and a malloc a free
28th Apr 2018, 7:45 AM
TransHedgehog
TransHedgehog - avatar