Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: A "simple" realloc() question. Message-ID: <10408@smoke.BRL.MIL> Date: 16 Jun 89 21:17:25 GMT References: <1606@csm9a.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 10 In article <1606@csm9a.UUCP> ddale@csm9a.UUCP (Doug Dale) writes: >When using realloc(), if it is necessary to move the information to >another location in memory because more memory is needed, is the old >memory freed? Yes -- realloc() moves the one-and-only instance of the data to a possibly new location; the former pointer (from an earlier malloc() or realloc()) is no longer usable when realloc() returns successfully. (If realloc() returns unsuccessfully, then the data is supposed to still be where it was and the previous pointer remains valid.)