Explain the difference between realloc() and free() in c++?



Explain the difference between realloc() and free() in c++?..

Answer / Sant Singh

realloc() is a C library function that changes the size of an allocated memory block. If the new size is larger, the contents of the original block are preserved. If the new size is smaller, the contents will be truncated. free() is used to deallocate a previously allocated memory block, freeing up the associated memory for future use.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is a node class?

1 Answers  


Which should be more useful: the protected and public virtuals?

1 Answers  


What is Destructor in C++?

1 Answers  


Explain the difference between new() and malloc() in c++?

1 Answers  


if int1 has the value 12, int has the value 18, and int3 has the value 21, what is the result: int1 < int2 && int2 < int 3

3 Answers  


Write a program which employs Recursion

1 Answers  


Out of fgets() and gets() which function is safe to use and why?

1 Answers  


What is the basic difference between C and C++?

1 Answers   NIIT,


What are friend functions in C++?

1 Answers   BlackRock,


What is the difference between reference type and pointers.

4 Answers   HCL,


What is command line arguments in C++? What are its uses? Where we have to use this?

1 Answers   HCL,


What is a loop? What are different types of loops in c++?

1 Answers  


Categories