C realloc()
Closed
sathishksk71
Blocked Profile - Nov 30, 2017 at 05:17 PM
- Posts
- 2
- Registration date
- Tuesday August 15, 2017
- Status
- Member
- Last seen
- August 17, 2017
Blocked Profile - Nov 30, 2017 at 05:17 PM
3 replies
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
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
Updated on Aug 17, 2017 at 12:29 AM
- 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