I have a small confusion in using calloc over malloc. I remember somewhere I have read that calloc is slower than malloc because calloc performs initialization to zero after performing memory allocation.
In the project I am working, I see that after malloc they are assigning zero to all the values as shown below,
str* strptr = (str*)malloc(sizeof(str));
memset(strptr,0,sizeof(str));
Here str is a structure.
This is similar to
str* strptr =(str*)calloc(1,sizeof(str));
I want to know whether using malloc over calloc has any advantages and which method is preferred.