Sujet : Re: Command Languages Versus Programming Languages
De : cross (at) *nospam* spitfire.i.gajendra.net (Dan Cross)
Groupes : comp.unix.programmerDate : 23. Nov 2024, 00:06:18
Autres entêtes
Organisation : PANIX Public Access Internet and UNIX, NYC
Message-ID : <vhr2pa$qid$1@reader2.panix.com>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
vhr0fj$1bq0o$1@dont-email.me>,
James Kuyper <
jameskuyper@alumni.caltech.edu> wrote:
On 11/22/24 14:05, Dan Cross wrote:
In article <87h67zrtns.fsf@doppelsaurus.mobileactivedefense.com>,
Rainer Weikusat <rweikusat@talktalk.net> wrote:...
char **argv
>
declares an array of pointers
>
No, it declares a pointer to a pointer to char.
>
Agreed.
>
(as each pointer in C points to an array)
>
That's absolutely not true. A pointer in C may refer to
an array, or a scalar. Consider,
>
char c;
char *p = &c;
char **pp = &p;
>
Not actually relevant. For purposes of pointer arithmetic, a pointer to
a single object is treated as if it pointed at the first element of a
1-element array of that object's type.
a) Please stop emailing me this stuff _and_ posting it here. I
have asked you this in the past, and previously you'd said that
it was because you switched news readers. That's fine, but that
was a year ago or more.
b) What you are referring to, from the section on Additive
Operators (6.5.7 in n3220; 6.5.6 in C99) is in reference to
pointer arithmetic; the statement that I was replying to was a
general statement about pointers, independent of issues of
pointer arithmetic. That is, it is not the case that, "each
pointer in C points to an array". The above example, to which
you replied, is a counterpoint to the general statement.
So while what you are saying is true, it doesn't change the
general point.
- Dan C.