本文介绍了malloc()和calloc()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮我吗?
malloc()和calloc()有什么区别?
Hi, Can any one help me.
what is the difference between malloc() and calloc()?
Explain in deep manner.
推荐答案
struct my_struct
{
int x;
int y;
}
...
my_struct* = calloc(10, sizeof(my_struct);
此处 [ ^ ]
使用calloc
时,内存也会被初始化.
希望这会有所帮助,
弗雷德里克(Fredrik)
It''s explained in more detail here[^]
The memory is also initialized when using calloc
.
Hope this helps,
Fredrik
这篇关于malloc()和calloc()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!