NULL question not in FAQ

Vox Populi ravim at gtenmc.UUCP
Tue Apr 2 12:05:28 AEST 1991


In article <1991Mar27.194101.1685 at grebyn.com> ckp at grebyn.com (Checkpoint Technologies) writes:
 >In article <1991Mar26.235643.4498 at ux1.cso.uiuc.edu> phil at 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 <stddisclaimer.h>  **************************
Ravi Mandava			e-mail :	ravim at gtenmc.gtetele.com
					  or    ravim at gtenmc.UUCP
*******************************************************************************



More information about the Comp.lang.c mailing list