What is the difference between malloc and calloc in terms of initialization of the allocated memory?

  • Calloc initializes memory to an undetermined value.
  • Calloc initializes memory to zero.
  • Malloc initializes memory to an undetermined value.
  • Malloc initializes memory to zero.
Malloc initializes memory to an undetermined value, while calloc initializes memory to zero. This difference is important when you want to ensure that allocated memory is initialized in a specific way.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *