我在接受采访时问过这个问题:
在C++中, 如果我们分配内存malloc并使用它delete来释放分配的内存怎么办? 如果我们使用new并使用它来释放内存free怎么办? 如果在代码中使用上述内容,我们将面临哪些问题?
在C++中,
malloc
delete
new
free
如果在代码中使用上述内容,我们将面临哪些问题?
我的回答是没有区别.这样说我是对的吗?
c++ malloc free memory-management new-operator
c++ ×1
free ×1
malloc ×1
memory-management ×1
new-operator ×1