What is the difference between realloc() and free()

Answer Posted / nitin

The free subroutine frees a block of memory previously
allocated by the malloc subroutine. Undefined results occur if
the Pointer parameter is not a valid pointer. If the Pointer
parameter is a null value, no action will occur. The realloc
subroutine changes the size of the block of memory pointed to
by the Pointer parameter to the number of bytes specified by
the Size parameter and returns a new pointer to the block. The
pointer specified by the Pointer parameter must have been
created with the malloc, calloc, or realloc subroutines and
not been deallocated with the free or realloc subroutines.
Undefined results occur if the Pointer parameter is not a
valid pointer.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a c program to find the sum of five entered numbers using an array named number

1622


What standard functions are available to manipulate strings?

567


Explain is it better to bitshift a value than to multiply by 2?

720


Why is c so popular?

655


What is volatile variable in c?

660






What is call by value in c?

565


Explain what are header files and explain what are its uses in c programming?

632


What is main () in c language?

605


What is %d called in c?

763


What does the && operator do in a program code?

701


Why doesnt the call scanf work?

679


What is nested structure in c?

616


Can you subtract pointers from each other? Why would you?

563


what are the 10 different models of writing an addition program in C language?

1443


In C, What is the #line used for?

1073