有什么用malloc
and free
当我们有new
and delete
在C++中。我猜两者的功能free
and delete
是一样的。
他们不一样。new
调用构造函数,malloc
只是分配内存。
还有,它是未定义的行为将两者混合(即使用new
with free
and malloc
with delete
).
在 C++ 中,你应该使用new
and delete
, malloc
and free
是出于与 C 的兼容性原因吗?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)