Difference between realloc() and free?

Answer Posted / fathimath fahima j

free :
#include <cstdlib>
Void free (void *ptr);

Free() function returns the memory
Pointed to by ptr to the heap. 

Realloc :
#include<cstdlib>
Void *realloc(void *ptr,size_t size);

The realloc function changes the size of
the previously allocated memory pointed to by ptr to dat specified by size.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2102


What is a superclass in oop?

665


What is object in oops?

612


What is encapsulation selenium?

554


What is property in oops?

565






Prepare me a program for the animation of train

1996


What is encapsulation with real life example?

570


What is encapsulation process?

575


What is destructor give example?

601


write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.

1778


Is this job good for future? can do this job post grduate student?

1689


What is the diamond problem in inheritance?

577


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

1637


What is static modifier?

630


What is polymorphism what are the different types of polymorphism?

563