Report

C realloc()

Ask a question sathishksk71 2Posts Tuesday August 15, 2017Registration date August 17, 2017 Last seen - Last answered on Nov 30, 2017 at 05:17 PM by ac3mark
Hi..

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

iam not able to understand the concept of realloc()..help me
Helpful
+1
plus moins
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.

Leave a comment
Helpful
+0
plus moins
Thank u.. it was very helpful
ac3mark 8299Posts Monday June 3, 2013Registration date ModeratorStatus December 5, 2017 Last seen - 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!
Reply
Leave a comment
Helpful
+0
plus moins
relloc() is an dynamic memory allocating function that is used in c language. This relloc() dynamically reallocates the memory block.
ac3mark 8299Posts Monday June 3, 2013Registration date ModeratorStatus December 5, 2017 Last seen - Nov 30, 2017 at 05:17 PM
Great answer. I am glad you agree with me!
Reply
Leave a comment

Member requests are more likely to be responded to.

Members can monitor the statuses of their requests from their account pages.

A CCM membership gives you access to additional options.

Not a member yet?

Sign up now. It takes less than a minute and is completely free!