C declarations
Stanley Friesen
friesen at psivax.UUCP
Fri Feb 15 03:26:32 AEST 1985
I think the article by jsdy at SEISMO is generally good, and clarifies
a major confusion, but I disagree on one minor point.
In article <8302 at brl-tgr.ARPA> jsdy at SEISMO.ARPA writes:
>
>An array (int ia[N];) is actually N real objects of the type of which
>you have the array. (Did I say that right?) So, in this case, if
>N == 4, then I have just reserved space for 4 int's. The real objects
>that exist, here, are ia[0], ia[1], ia[2], and ia[3]. The symbol "ia"
>here refers to no single existing object.
>
>So, now comes the confusing part. "Ia" doesn't refer to any existing
>object -- so, for instance, an attempt to say:
> ia = new_value;
>gets an error from C. But if we use "ia" as a pure value, it appears
>to have a value which is the address of the first element of the array
>(often put, "the address of the array"). We can then do pointer arith-
>metic with this value! In this way, it a p p e a r s to be (but is
>not) a pointer.
I say "ia" *is* a pointer, a pointer *constant*, with the
same relation to a pointer variable as an integer constant has to
an integer varible. This way the basis for both the similarities
*and* differences between "int ia[n]" and "int *ip" are explained.
--
Sarima (Stanley Friesen)
{trwrb|allegra|cbosgd|hplabs|ihnp4|aero!uscvax!akgua}!sdcrdcf!psivax!friesen
or
quad1!psivax!friesen
More information about the Comp.lang.c
mailing list