C realloc()

Closed
sathishksk71 Posts 2 Registration date Tuesday August 15, 2017 Status Member Last seen August 17, 2017 - Aug 16, 2017 at 12:40 AM
 Blocked Profile - Nov 30, 2017 at 05:17 PM
Hi..

Iam refreshing c language using this useful resource http://c-language.com/

iam not able to understand the concept of realloc()..help me

3 responses

From what I briefly read, it allocates used memory. SO lets say you have an array, and you want to expand the array, in basic you would REDIM the array, with a new value, as in:

DIM A(1) REM variable A now has 1 storage space in its array.
....some code manipulates variable A and it needs more space......
REDIM A(5)
Now variable A can hold 5 values! Remember when trying to access arrays, the count starts a 0, not 1!

I believe that is what realloc(ate) does. Let me know if anyone comes to the same conclusion.

It's kind of fun to do the impossible! -Walter Elias Disney
sathishksk71 Posts 2 Registration date Tuesday August 15, 2017 Status Member Last seen August 17, 2017
Updated on Aug 17, 2017 at 12:29 AM
Thank u.. it was very helpful
Blocked Profile
Aug 17, 2017 at 04:45 PM
I will leave it up to you, if you are satisfied, to mark as solved! thank you for the feedback, and not just using the knowledge and leaving us without feedback!
Blocked Profile
Nov 30, 2017 at 07:10 AM
relloc() is an dynamic memory allocating function that is used in c language. This relloc() dynamically reallocates the memory block.
Blocked Profile
Nov 30, 2017 at 05:17 PM
Great answer. I am glad you agree with me!