Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!uw-beaver!milton!sumax!amc-gw!pilchuck!dataio!gtenmc!ravim From: ravim@gtenmc.UUCP (Vox Populi) Newsgroups: comp.lang.c Subject: Re: NULL question not in FAQ Message-ID: <1103@gtenmc.UUCP> Date: 2 Apr 91 02:05:28 GMT References: <1991Mar26.235643.4498@ux1.cso.uiuc.edu> <1991Mar27.194101.1685@grebyn.com> Reply-To: ravim@gtenmc.UUCP (Ravi Kumar Mandava) Organization: GTE Telecom, Inc. Bothell, WA Lines: 23 In article <1991Mar27.194101.1685@grebyn.com> ckp@grebyn.com (Checkpoint Technologies) writes: >In article <1991Mar26.235643.4498@ux1.cso.uiuc.edu> phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) writes: >>Given that the compiler is supposed to translate the constant "0" to the >>appropriate value for a NULL pointer on the machine type, how does one >>get a pointer value whose representation happens to be all zeroes, but >>is a non-NULL pointer? > >void some_func(void) { > int **ip; > > ip = (int **) calloc(sizeof(int *), 1); The same result (getting a pointer value to be all null bytes) can also be achieved by declaring the pointer variable to be either static or/and global, since static/global variables are automatically initialized to zeroes. - Ravi Mandava -- ********************** #include ************************** Ravi Mandava e-mail : ravim@gtenmc.gtetele.com or ravim@gtenmc.UUCP *******************************************************************************