I see in C++ there are multiple ways to allocate and free data and I understand that when you call malloc you should call free and when you use the
malloc
free
malloc() is used to dynamically assign memory in C while the same work is done by new() in c++. So you cannot mix coding conventions of 2 languages. It would be good if you asked for difference between calloc and malloc()