State the difference between realloc and free.



State the difference between realloc and free...

Answer / Bappa Bagchi

realloc is used to change the size of a block of memory previously allocated with malloc, calloc, or realloc. If the new size is larger, the contents of the old block are copied to the new location and the original block is returned. If the new size is smaller, the contents are preserved as much as possible and any remaining memory is deallocated. free is used to deallocate a block of memory previously allocated with malloc, calloc, or realloc, making it available for future allocation.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What is bin sh c?

1 Answers  


What is Generic pointer? What is the purpose of Generic pointer? Where it is used?

3 Answers  


52.write a “Hello World” program in “c” without using a semicolon? 53.Give a method to count the number of ones in a 32 bit number? 54.write a program that print itself even if the source file is deleted? 55.Given an unsigned integer, find if the number is power of 2?

9 Answers  


How to reverse a linked list

1 Answers   Aricent, Fidelity, IBM, TCS,


What is operator precedence?

1 Answers  


How to write a code for implementing my own printf() and scanf().... Please hep me in this... I need a guidance... Can you give an coding for c... Please also explain about the header files used other than #include<stdio.h>...

1 Answers  


what is the output? #define fun(a,b,t) (g ##t=(a),(a)=(b),(b)=g##t) float gfloat; main() { float a=1.12,b=3.14; fun (a,b,float); printf("na=%4.2f,b=%4.2f",a,b); } A)Error in Defining Macro B)a=1.12,b=3.14 C)a=3.14,b=1.12 D)None of the Above

3 Answers   Accenture, Infosys, Wipro,


What is the use of define in c?

1 Answers  


How can I discover how many arguments a function was actually called with?

1 Answers  


How to access or modify the const variable in c ?

16 Answers   HCL, HP,


what is the flow of execution in cprogram? ex:printf();,scanf();

2 Answers  


how can we Declare a variable in c without defining it.

1 Answers   TCS,


Categories