Fun with * and &

Root Boy Jim rbj at icst-cmr
Fri Jun 27 06:42:43 AEST 1986

> Just a quick remark.  When I was learning C, I understood that "*pi"
> meant "the contents of pi," but somehow had difficulty conceptualizing
> why the declaration "int *pi;" declares pi as a pointer to an int;
> that is, I knew it was a convention I had to memorize, but it didn't
> seem mnemonic to me. 

It may help to look at as a declaration that (*p) is an int. Therefore,
you can infer that p is a pointer to an int. See K&R, page 90.

	(Root Boy) Jim Cottrell		<rbj at>
	Hold the MAYO & pass the COSMIC AWARENESS...

More information about the Comp.lang.c mailing list