Which Function Reallocates Memory?
In the C Programming Language, the Realloc Function Is Used to Resize a Block of Memory That Was Previously Allocated. the Realloc Function Allocates a Block...
In the C Programming Language, the realloc function is used to resize a block of memory that was previously allocated. The realloc function allocates a block of memory (which be can make it larger or smaller in size than the original) and copies the contents of the old block to the new block of memory, if necessary.
How do you reallocate memory?
Size of dynamically allocated memory can be changed by using realloc(). As per the C99 standard: void * realloc ( void *ptr, size_t size); realloc deallocates the old object pointed to by ptr and returns a pointer to a new object that has the size specified by size.
Must Read
Which function is used to release memory?
free() function is used to release the memory which is dynamically reserved for blocks & which is no longer needed. Syntax: void free(void *block); It releases the block of specified pointer.