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
How can you invoke another program from within a C program?
If errno contains a nonzero number, is there an error?
What does *p++ do? What does it point to?
What will be the outcome of the following conditional statement if the value of variable s is 10?
Why is sprintf unsafe?
Why is a semicolon (;) put at the end of every program statement?
What is a far pointer in c?
What is the auto keyword good for?
write a c program to calculate sum of digits till it reduces to a single digit using recursion
What is a string?
Differentiate between calloc and malloc.
What is function prototype in c language?
Subtract Two Number Without Using Subtraction Operator
What are the primitive data types in c?
What are types of structure?