Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!iuvax!rutgers!mcnc!ecsvax!dukeac!sbigham From: sbigham@dukeac.UUCP (Scott Bigham) Newsgroups: comp.lang.c Subject: 5[array] (was Re: "for" loops in C ...) Message-ID: <1076@dukeac.UUCP> Date: 3 Nov 88 00:50:15 GMT References: <14999@agate.BERKELEY.EDU> <4700019@m.cs.uiuc.edu> <6945@cdis-1 <10742@cup.portal.com> Reply-To: sbigham@dukeac.UUCP (Scott Bigham) Organization: Academic Computing, Duke University, Durham, NC Lines: 20 In article <10742@cup.portal.com> ts@cup.portal.com (Tim W Smith) writes: >I don't know about i[ptr] being less readable than ptr[i]. Most people I >have heard would say when describing an algorithm in English, "Then you take >the ith element of the array and multiply by foo". i[array]*foo has the >words in C in the same order they would be spoken. a[b] looks like an array reference, so, naive programmer that I am, I assume that it _is_ an array reference. In particular, I assume that a is an array and b is an index into that array. Something that does otherwise is less readable to me, and I suspect I'm not alone. The point is, is there ever any practical reason to use this construct? Do you ever use it? Does anyone? sbigham -- Scott Bigham "The opinions expressed above represent Internet sbigham@dukeac.ac.duke.edu me and everyone that agrees with me. USENET sbigham@dukeac.UUCP If that includes Duke University, ...!mcnc!ecsgate!dukeac!sbigham I'll be amazed."