Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!brunix!gvr From: gvr@brunix (George V. Reilly) Newsgroups: comp.lang.c Subject: Re: Summary: Realloc of function parameter problem. Message-ID: <21645@brunix.UUCP> Date: 27 Nov 89 20:21:22 GMT References: <3752@umiami.miami.edu> <1989Nov26.195601.20874@virtech.uucp> <3772@umiami.miami.edu> Sender: news@brunix.UUCP Reply-To: gvr@panda.UUCP (George V. Reilly) Organization: Brown University Department of Computer Science Lines: 27 In article <3772@umiami.miami.edu> SLORES@umiami.miami.edu (Stanislaw L. Olejniczak) writes: < Many thanks for the numerous answers I received to my question. The < problem was, of course, the requirement that realloc receives as an < argument either a pointer previously returned by a malloc _or_ (char *)0, < while I passed to it a pointer initialized as char *p = "A string". Some < respondent warned me that some compiler implementations get confused if < the argument is (char *)0. < < Knowing all this I went back to TFM, including some for beginners, some for < intermediate, and some for advanced users, and looked again for a clear < reference to that fact. I was able to piece the reason from various < section of K&R, but simply _nowhere_ could I find documentation for < realloc stating that fact. This includes basic and intermediate manuals, < which went to great lengths to explain dynamic memory allocation. < < If someone would have a suggestion on a book or two that would go into < such matters in a fairly clear manner, I woulod appreciate the < recommendations. Again, thanks for all your help and assistance. _C: A Reference Manual_, Second Edition, Samuel P. Harbison & Guy L. Steele Jr, Prentice-Hall, 1987, ISBN 0-13-109802-0 gives a good explanation of how to use realloc(). It also gives a fairly detailed explanation of how to use the rest of the standard library. ------ George V. Reilly gvr@cs.brown.edu uunet!brunix!gvr gvr@browncs.bitnet Box 1910, Brown U, Prov, RI 02912