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

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...