Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!seismo!cmcl2!rna!cubsvax!peters From: peters@cubsvax.UUCP (Peter S. Shenkin) Newsgroups: net.lang.c,net.micro.pc,net.unix Subject: Re: C'mon, guys! (Really, pointer pedagogy) Message-ID: <497@cubsvax.UUCP> Date: Sat, 5-Jul-86 13:31:50 EDT Article-I.D.: cubsvax.497 Posted: Sat Jul 5 13:31:50 1986 Date-Received: Sun, 6-Jul-86 01:25:21 EDT References: <487@cubsvax.UUCP> Reply-To: peters@cubsvax.UUCP (Peter S. Shenkin) Organization: Columbia Univ. Bio. CG Fac., NY Lines: 34 Xref: watmath net.lang.c:9745 net.micro.pc:9005 net.unix:8526 In article jso@edison.UUCP (John Owens) writes: >In article <487@cubsvax.UUCP>, peters@cubsvax.UUCP writes: >> 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. >> Peter S. Shenkin Columbia Univ. Biology Dept., NY, NY 10027 > >Maybe it's my machine-language heritage showing, but I've always found >it least confusing to think of "pi" as "the contents of pi" (which is >a pointer), "*pi" as "that which (the contents of) pi points to", >"int i" as declaring i to contain an int, and "int *pi" as declaring >pi to contain a pointer to an int. > Like many revelations of mine, I just discovered that this one was right there in K&R from the first; "...I guess I was too young / to realize...": p90: int *px; is intended as a mnemonic; it says that the combination *px is an int... I also note with amazement that I used the word "mnemonic," which also occurs in this K&R passage, in my original posting. I rarely use that word, yet I hadn't read that section of K&R for about two years (that I can recall) and its purport evidently eluded me at the time. People have been accused of plagiarism for less.... Peter S. Shenkin Columbia Univ. Biology Dept., NY, NY 10027 {philabs,rna}!cubsvax!peters cubsvax!peters@columbia.ARPA