malloc
is used to allocate memory dynamically (from the system
heap), and free
is used to deallocate memory that was previously
allocated by malloc
. In C++, new
is an operator that
is similar to malloc
, and delete
is an operator that is
similar to free
.
However, there are important differences between malloc
and
new
. Similarly, free
and delete
are different in
important ways.