Difference between realloc() and free?

Answer Posted / gouthami..

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 ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is html an oop?

581


What is object in oops?

612


What is multilevel inheritance explain with example?

626


Advantage and disadvantage of routing in telecom sector

786


What is overriding in oops?

602






What is the oops and benefits of oops programming?

553


Why polymorphism is used in oops?

584


officer say me - i am offered to a smoking , then what can you say

1579


What are the three main types of variables?

600


Why do we use class in oops?

555


What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?

1652


What is the real time example of encapsulation?

595


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’.

1780


c++ program to swap the objects of two different classes

1762


Which is better struts or spring?

620