Fun with * and &

The Wumpus aptr at ur-tut.UUCP
Wed Jun 25 03:23:24 AEST 1986


In article <1250 at ncoast.UUCP> allbery at ncoast.UUCP (Brandon Allbery) writes:
>Expires:
>
>Quoted from <487 at cubsvax.UUCP> ["Re: C'mon, guys! (Really, pointer pedagogy)"], by peters at cubsvax.UUCP...
>+---------------
>| 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.  Then, about
>| a month ago, revelation!:  read this as "the contents of pi is an integer;"
>| which implies, "pi is that which contains (or points to)" an integer.  Somehow 
>| it made thinking about the declarations easier.  It's occurred to me that maybe
>| everyone else in the world sees this from day 1, but for us dumb folks, having
>| this reading pointed out would probably make the learning process easier....
>+---------------
>
>Easy:  Use the Algol 68 method.

If you have worked with Forth, the idead of pointers to variable locations
and having to give scanf an address to put the returned value into is
natural because variables in Forth are really just address pointers.

:-)
The Wumpus



More information about the Comp.lang.c mailing list