Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!lvc From: lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) Newsgroups: comp.lang.c Subject: Is &a[NTHINGS] legal Message-ID: <12074@tut.cis.ohio-state.edu> Date: 30 Apr 88 12:14:56 GMT Organization: Ohio State Computer & Info Science Lines: 26 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 */ ... I like 1 better than 2 since there are fewer characters to type and I find it quicker and easier to comprehend. The dpANS says & only applies to objects that are not bit fields or have the register qualifier. In this example, one could argue that a[NTHINGS] doesn't even exist so that & should be invalid on it. Will 1 be guaranteed to work in ANSI-C? Thanks, -- Larry Cipriani, AT&T Network Systems and Ohio State University Domain: lvc@tut.cis.ohio-state.edu Path: ...!cbosgd!osu-cis!tut.cis.ohio-state.edu!lvc (weird but right)