Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!decwrl!pyramid!prls!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: comp.misc Subject: Re: Programming style with arrays, enquiry Keywords: programming style, arrays Message-ID: <2853@mmintl.UUCP> Date: 17 May 88 14:52:54 GMT References: <724@dick.cs.vu.nl> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Ashton-Tate Corporation, East Hartford Development Center Lines: 15 In article <724@dick.cs.vu.nl> dick@cs.vu.nl (Dick Grune) writes: >1. Address of first item and length. >This is clean and can handle zero-length arrays. It gives, however, rise to >incessant additions, since one wants the upper limit much more often than the >length: > if (p >= array + length) error(); Note that this is a function of the programming language in use. In C, where arrays are most often referenced by explicit pointer arithmetic, this is true. But in most programming languages, arrays are referenced by indexing (as, indeed, they can be in C). And, in this case, the length is exactly what you need. -- Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Ashton-Tate 52 Oakland Ave North E. Hartford, CT 06108