Global ptrs init to NULL or 0000?

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Tue Nov 12 10:13:15 AEST 1985


> OK, so what does
> 
> static union {
> 	int i;
> 	char *p;
> 	} foo;
> 
> get initialized to on a machine with a non-0 NULL?

The first member of the union is initialized with the
appropriate form of 0, in this case (int)0.  That is
the main necessity for defining initializations of
unions.  The effect of trying to dereference the `p'
member of this union is indeterminate.



More information about the Comp.lang.c mailing list