type cast in initializer

Hal Peterson hrp at cray.UUCP
Tue Feb 4 04:53:51 AEST 1986


> >	int	x = 0;
> >	char	*ptr = (char *) &x;
> 
>     In any case, I'm not sure why you'd want to do what your example does,
> since the cast here is a no-op.  

An int pointer does not necessarily have the same format as a char pointer.
Consider a word addressible machine on which the char's are packed into the
words.
-- 
Hal Peterson / Cray Research / 1440 Northland Dr. / Mendota Hts, MN  55120
	UUCP:  ihnp4!cray!hrp		phone:  (612) 681-3085



More information about the Comp.lang.c mailing list