we have to use realloc only after malloc or calloc ? or we
can use initially with out depending on whether we are
using malloc or calloc in our program ?

Answer Posted / vignesh1988i

ya we must use realloc (RE-ALLOCATION) only after malloc (MEMORY ALLOCATION) ....
actually realloc is a fuction which will be mainly implemented after knowing the accurate amount of memory that is going to be used... if our memory is allocated using malloc is less compared to the total values that is going to be stored we will RE-ALLOCATE the memory to our wish to store all the values...

but in other case if the data has been stored in the allocated block by malloc , but still more is remaining we can again RE-ALLOCATE usin realloc funcion.......


thank u

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you invoke another program from within a C program?

620


If errno contains a nonzero number, is there an error?

809


What does *p++ do? What does it point to?

620


What will be the outcome of the following conditional statement if the value of variable s is 10?

771


Why is sprintf unsafe?

621






Why is a semicolon (;) put at the end of every program statement?

630


What is a far pointer in c?

599


What is the auto keyword good for?

631


write a c program to calculate sum of digits till it reduces to a single digit using recursion

2725


What is a string?

670


Differentiate between calloc and malloc.

762


What is function prototype in c language?

619


Subtract Two Number Without Using Subtraction Operator

360


What are the primitive data types in c?

579


What are types of structure?

608