When reallocating memory, if any other pointer points to same piece of memory, do I have to readjust these other pointers or do they get readjusted automatically?
Printable View
When reallocating memory, if any other pointer points to same piece of memory, do I have to readjust these other pointers or do they get readjusted automatically?
No, they'll still point to the start of the block of memory, ie you don't have to touch them. http://www.opengroup.org/onlinepubs/...h/realloc.html
Quote:
Originally Posted by http://www.opengroup.org/onlinepubs/007908775/xsh/realloc.html
Please clarify, i m in doubt
You will have to readjust ALL the pointers following realloc, since realloc can actually move the memory to somewhere else.