Saturday, 2 July 2016

c++ - Malloc or Calloc and when







Is calloc same as malloc with memset?? or is there any difference




char *ptr;
ptr=(char *)calloc(1,100)




  or



char *ptr;
ptr=(char *) malloc(100);
memset(ptr,0,100);


No comments:

Post a Comment