The realloc( ) function expands the existing allocated memory if it finds enough contiguous memory locations that are required. If enough contiguous memory blocks are not available then the new memory block is allocated. The existing data is copied and the original memory block is freed.