Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.lang.c Subject: Re: Q: Realloc of function parameter problem. Message-ID: <1989Nov26.195601.20874@virtech.uucp> Date: 26 Nov 89 19:56:01 GMT References: <3752@umiami.miami.edu> Organization: Virtual Technologies Inc. Lines: 19 In article <3752@umiami.miami.edu>, SLORES@umiami.miami.edu (Stanislaw L. Olejniczak) writes: > *substr = (char *) realloc ( (unsigned) (numchar + 1), *substr); First, you must RTFM. The order of arguments to realloc is: realloc(ptr,size); char * ptr; unsigned size; Second, although not explicitly stated in the manual, the pointer passed to realloc must be a ptr that was returned by a previous malloc. Your example was passing a pointer to an automatic variable. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+