Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!brl-adm!umd5!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Pointers and Arrays Message-ID: <10403@mimsy.UUCP> Date: 31 Jan 88 05:36:20 GMT References: <461@auvax.UUCP> <28700025@ccvaxa> <7159@brl-smoke.ARPA> <1329@laidbak.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 19 In article <1329@laidbak.UUCP> daveb@laidbak.UUCP (Dave Burton) writes: >K&R, Chapter 5, page 98, Paragraph just above last example: >"Pointer subtraction is also valid: if p and q point to members of the > same array, p-q is the number of elements between p and q." This section of K&R is descriptive, not prescriptive. What does the appendix have to say? At any rate, the number of elements `between' p and q (via p-q) in +---+---+---+---+ | 0 | 1 | 2 | 3 | +---+---+---+---+ q p is easily seen as -2, if you just turn your brain around. :-) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris