The function ________ in C changes the size of the memory block pointed to by a given pointer.
- realloc()
- free()
- malloc()
- calloc()
The correct option is 'realloc()'. The realloc() function is used to change the size of a previously allocated memory block, making it suitable for resizing dynamic arrays.
Loading...
Related Quiz
- In C, the function ________ is used to allocate memory for an array of elements and initialize them to zero.
- Enumerations provide a way to assign ________ to a set of named constants.
- In the context of function pointers in C, a callback function is a function that is passed as a(n) ________ to another function.
- The ________ directive can be used in C to include a file only once in a program.
- In a database application, you need to sort a list of names (strings) in alphabetical order. Which string handling function might be useful in this scenario?