To resize a previously allocated memory block, the function ________ is used in C.
- calloc()
- free()
- malloc()
- realloc()
To resize a previously allocated memory block in C, the function realloc() is used. It allows you to change the size of the memory block while preserving the existing data. malloc() and calloc() are used for initial memory allocation, and free() deallocates memory.
Loading...
Related Quiz
- A ________ allows multiple variables to share the same memory location.
- The function ________ is used in C to allocate memory for an array of specified size dynamically.
- What is the role of the 'continue' statement in a loop?
- You're working on a C program that needs to manipulate and process data about a list of products in a store. Each product has several attributes like name, price, and quantity. What approach would you take to store and process this data efficiently?
- To write data to a file, the file must be opened in ________ mode.