On Tue, 25 Nov 2003, nobody wrote:
>
> Now, what about 7.1.1p1 "A pointer to a string is a pointer to
> its initial (lowest addressed) character." Where is the *real*
> beginning (of a string)? How do we know which character ('first'
> or 'last') is at lowest address (James' quote about *first* pair)?
> I have a feeling I'm wrong, just need some standard* ptr as to
> where.
To determine whether pointer P contains a lower value (points
to a lower address) than pointer Q, you can use the < operator:
if (P < Q) { ... }
In general, it should be obvious that (&s[0] < &s[k]) for
all positive values of k.
(Note, of course, that the semantics of < are only defined
when P and Q point to elements of the same array, or one past
the last element of that array; where single objects count as
one-element "arrays" for purposes of simplification. You
can't portably compare any old pair of pointers.)
-Arthur