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 read a directory in a C program?
Is main an identifier in c?
Explain what is the difference between a string and an array?
Why is c so important?
What is c language in simple words?
Is sizeof a keyword in c?
What is malloc calloc and realloc in c?
Can variables be declared anywhere in c?
How can I get random integers in a certain range?
What is ponter?
What is the sizeof () a pointer?
What is array within structure?
Are global variables static in c?
What extern c means?
Can you explain the four storage classes in C?