Difference in uses between malloc and calloc

前端 未结 7 462
花落未央
花落未央 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.

提交回复
热议问题