Do I have to call memset after I allocated new memory using malloc

后端 未结 4 2011
情书的邮戳
情书的邮戳 2020-12-16 18:02
#include \"stdlib.h\"
#include \"stdio.h\"
#include \"string.h\"
int main(int argc, char* argv[])
{
    int *test = malloc(15 * sizeof(int));
    for(int i = 0;i <         


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-16 18:37

    When you request for a memory from heap, heap will just allocate any block of memory available to it. This block of memory may have some data depending upon a previous write.

提交回复
热议问题