Path: utzoo!mnetor!uunet!husc6!im4u!ut-sally!bcm!eyeball.ophth.bcm.tmc.edu!biff From: biff@eyeball.ophth.bcm.tmc.edu (Brad Daniels) Newsgroups: comp.lang.c Subject: Re: Is &a[NTHINGS] legal Message-ID: <1086@gazette.bcm.tmc.edu> Date: 5 May 88 22:11:21 GMT References: <12074@tut.cis.ohio-state.edu> Sender: usenet@bcm.tmc.edu Reply-To: biff@eyeball.ophth.bcm.tmc.edu.UUCP (Brad Daniels) Organization: Low Vision Project, Baylor College of Medicine, Houston, Tx Lines: 23 In article <12074@tut.cis.ohio-state.edu> lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes: >Is it legal to apply the & (address of) operator to an array >element that is non-existent? Given: > sometype a[NTHINGS], *p; >Should: > for (p = a; p < &a[NTHINGS]; p++) /* 1 */ > ... >be written as: > for (p = a; p <= &a[NTHINGS-1]; p++) /* 2 */ > ... Whether or not the above is legal, I think it should probably be written as: for (p = a; p < (a+NTHINGS); p++) Or am I missing something obvious? - Brad - Brad Daniels | biff@eyeball.ophth.bcm.tmc.edu The Low Vision Project | If money can't buy happiness Baylor College of Medicine | I guess I'll have to rent it. - Weird Al