C realloc() [Closed]

sathishksk71 2 Posts Tuesday August 15, 2017Registration date August 17, 2017 Last seen - Aug 16, 2017 at 12:40 AM - Latest reply: ac3mark 10759 Posts Monday June 3, 2013Registration dateModeratorStatus November 2, 2018 Last seen
- 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
See more 

5 replies

Best answer
ac3mark 10759 Posts Monday June 3, 2013Registration dateModeratorStatus November 2, 2018 Last seen - Updated by ac3mark on 16/08/17 at 06:05 PM
1
Thank you
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

Thank you, ac3mark 1

Something to say? Add comment

CCM has helped 1447 users this month

sathishksk71 2 Posts Tuesday August 15, 2017Registration date August 17, 2017 Last seen - Updated by sathishksk71 on 17/08/17 at 12:29 AM
0
Thank you
Thank u.. it was very helpful
ac3mark 10759 Posts Monday June 3, 2013Registration dateModeratorStatus November 2, 2018 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!
gainerp 13 Posts Friday November 3, 2017Registration date February 23, 2018 Last seen - Nov 30, 2017 at 07:10 AM
0
Thank you
relloc() is an dynamic memory allocating function that is used in c language. This relloc() dynamically reallocates the memory block.
ac3mark 10759 Posts Monday June 3, 2013Registration dateModeratorStatus November 2, 2018 Last seen - Nov 30, 2017 at 05:17 PM
Great answer. I am glad you agree with me!
Respond to gainerp