Specify the 2 library functions to dynamically allocate memory?
By BYJU'S Exam Prep
Updated on: September 25th, 2023
Specify the 2 library functions to dynamically allocate memory?
- malloc() and memalloc()
- alloc() and memalloc()
- malloc() and calloc()
- memalloc() and faralloc()
Answer- C. malloc() and calloc()
The library functions to allocate memory is malloc() and calloc() methods.
Solution
The answer to the question: Specify the 2 library functions to dynamically allocate memory is option C which is malloc() and calloc(). The malloc or memory allocation method is used to allocate memory dynamically. It returns a void pointer and takes only one input which is in bytes. While calloc() or contiguous allocation method dynamically allocates the specified number of chunks of memory of a specified type. It works similar to malloc(), it initializes each block with 0(zero).
☛ Related Questions: