Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site psivax.UUCP Path: utzoo!utcs!lsuc!pesnta!hplabs!sdcrdcf!psivax!friesen From: friesen@psivax.UUCP (Stanley Friesen) Newsgroups: net.lang.c Subject: Re: C declarations Message-ID: <328@psivax.UUCP> Date: Thu, 14-Feb-85 12:26:32 EST Article-I.D.: psivax.328 Posted: Thu Feb 14 12:26:32 1985 Date-Received: Sun, 17-Feb-85 06:47:17 EST References: <8302@brl-tgr.ARPA> Reply-To: friesen@psivax.UUCP (Stanley friesen) Organization: Pacesetter Systems Inc., Sylmar, CA Lines: 31 Summary: I think the article by jsdy@SEISMO is generally good, and clarifies a major confusion, but I disagree on one minor point. In article <8302@brl-tgr.ARPA> jsdy@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