Summary: Realloc of function parameter problem.

George V. Reilly gvr at brunix
Tue Nov 28 07:21:22 AEST 1989


In article <3772 at umiami.miami.edu> SLORES at 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 at cs.brown.edu
uunet!brunix!gvr   gvr at browncs.bitnet	Box 1910, Brown U, Prov, RI 02912



More information about the Comp.lang.c mailing list