Difference between realloc() and free?

Answer Posted / alka

free()is a macro used to deallocate memory.
when we need more memory realoc() reallocate memory
according to given size, if there is no memory 4
alocation ,it will free previous allocated memory &
allocate new one using malloc().
ex: int *p = realloc(p,sizeof(p)*2);

Is This Answer Correct ?    15 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the types of inheritance?

602


What is constructor overloading in oop?

601


What is encapsulation oop?

574


What is the renewal class?

2161


write a programe to calculate the simple intrest and compund intrest using by function overlading

1666






What are constructors in oop?

587


What does oop mean in snapchat?

680


Why do we use polymorphism in oops?

577


design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)

6145


What is an interface in oop?

591


What are the 3 principles of oop?

616


What is encapsulation example?

545


What are the 3 pillars of oop?

611


Why do we use inheritance?

628


write a program that takes input in digits and display the result in words from 1 to 1000

1986