L
lancer6238
Hi,
I'm curious to know if there are any major differences between using
calloc and malloc.
I understand that calloc initializes the variables that it has
allocated memory for (although I remember coming across an article
that says this is not always true), while malloc does not. I also
remember reading somewhere that malloc could be slightly faster than
calloc, though from my personal experience, I don't see a big
difference in terms of speed.
I seem to see people using malloc more, though I prefer calloc because
of the initialization.
So are there any more differences between the two?
Thank you.
I'm curious to know if there are any major differences between using
calloc and malloc.
I understand that calloc initializes the variables that it has
allocated memory for (although I remember coming across an article
that says this is not always true), while malloc does not. I also
remember reading somewhere that malloc could be slightly faster than
calloc, though from my personal experience, I don't see a big
difference in terms of speed.
I seem to see people using malloc more, though I prefer calloc because
of the initialization.
So are there any more differences between the two?
Thank you.