Difference in uses between malloc and calloc

前端 未结 7 440
花落未央
花落未央 2020-12-22 05:00
gcc 4.5.1 c89

I have written this source code for my better understanding of malloc and calloc.

I understand, but just have a few questions

相关标签:
7条回答
  • 2020-12-22 05:36

    The first two create an array of 5 devices in contiguous memory. The last malloc, done five times, will create 5 individual devices which are not guaranteed to be in contiguous memory.

    0 讨论(0)
提交回复
热议问题