What is the primary purpose of the malloc function in C?

  • To allocate memory for a single variable
  • To allocate memory for an array of elements and initialize them
  • To free memory allocated by calloc
  • To reallocate memory for an array
The primary purpose of the malloc function in C is to allocate memory for a single variable. It returns a pointer to the allocated memory, which can be used to store data.
Add your answer
Loading...

Leave a comment

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