Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!apple!netcom!teda!ditka!mcdchg!ddsw1!olsa99!tabbs!pscnet!kean From: kean@pscnet.UUCP (Kean Johnston) Newsgroups: comp.lang.c Subject: realloc((char *)NULL,size) - how standard ? Keywords: realloc ansi standard xenix Message-ID: <1991Feb16.010828.2152@pscnet.UUCP> Date: 16 Feb 91 01:08:28 GMT Organization: Progressive Systems College Lines: 19 The other day I had occasion to write a little C program which was repeatedly increasing an array. Of course, realloc() is perfect for this. However, in Harbison and Steele, they state that if you pass as the first parameter to realloc a NULL pointer, then realloc() will allocate a block of size bytes for you. No need to malloc the very first block. Well, under Xenix 2.3.3 with 2.3.0 DevSys, this isn't so. If you don't do the initial alloc() of the block, then realloc fails. Is using a NULL pointer as the first parameter to realloc() a "standard" feature of the function, and if so, which of the plethora of standards? Thanks in advance, Kean -- +----------------------------------------------------------------------------+ | Kean Johnston: ..!ddsw1!proxima!olsa99!tabbs!pscnet!kean kean@pscnet.UUCP | | "I think, therefore I AM" - Rene Descartes | +----------------------------------------------------------------------------+