I've read that the difference between calloc and malloc is that calloc initializes the memory to the default value of the type declared.
- For struct, what is the default value?
- Is there a difference between using calloc and malloc for dynamic array of struct?
- Would the members of the struct also be initialized?
calloc()initializes memory with all bytes zero. So typically all values are initialized zero and all pointersNULL(whereNULLis all bytes zero -- which I know of no case that isn't true, but also isn't guaranteed).malloc()does no initialization whatsoever.