[Solved] differences between new and malloc in c++ [duplicate]
[ad_1] malloc allocates memory only, it doesn’t invoke constructors which can leave objects in an indeterminate state. In C++ you should almost never use malloc, calloc or free. And if possible avoid new and new[] as well, use object instances or vectors of instances instead. As for your second question (which is really unrelated to … Read more