本文介绍了C中的动态内存分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
1)如果我创建malloc()并增加大小我使用realloc()
2)如果我创建malloc(),使用free()删除内存,再次使用malloc()增加尺寸
如果我使用2方法而不是1也有缺点1和2方法之间有什么区别
我尝试了什么:
不知道是否有任何区别o缺点
1)If I create malloc() and to increase size i use realloc()
2)If i create malloc() , use free() to remove memory and again malloc() to increase the size
Did there is disadvantage if I use 2 method instead of 1 also did there any difference between 1 and 2 method
What I have tried:
no idea if there can be any difference o disadvantage
推荐答案
这篇关于C中的动态内存分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!