[Solved] differences between new and malloc in c++ [duplicate]
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 the … Read more