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 data hiding and abstraction same?

567


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

1403


What does enum stand for?

607


What is the renewal class?

2161


Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?

4235






What is constructor overloading in oop?

601


What is the problem with multiple inheritance?

582


What is oops in simple words?

577


How can you overcome the diamond problem in inheritance?

765


Why do we use oops?

591


what are the ways in which a constructors can be called?

1581


What is a class oop?

592


What is overriding in oops?

599


What is debug class?what is trace class? What differences are between them? With examples.

1604


When not to use object oriented programming?

567