Nils O. Selåsdal wrote:
Frederick Gotham wrote:
Richard Heathfield posted:
Yes. The loop terminates when start is pointing ***just*** past the end of
the array. This is legal, provided you don't go any further than that,and
provided you don't dereference.
Incidently, the following constitutes a dereference:
Not when it's the operand of unary &.
When it's the operand of unary &, compilers in practice don't have
problems with it, the meaning is obvious, and as suspected by Frederick
Gotham in the message you replied to, it's allowed in C99. However,
evaluation of array[N] is disallowed in all versions of C, and unless
C90 specifically says array[N] is not evaluated when it is the operand
of the address-of operator (wording which I believe is new to C99), the
behaviour is undefined in C90.
int array[N];
int *p = &array[N];