Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: pointers to arrays Message-ID: <16035@mimsy.UUCP> Date: 19 Feb 89 22:48:31 GMT References: <19784@uflorida.cis.ufl.EDU> <227300001@uxa.cso.uiuc.edu> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 25 In article <227300001@uxa.cso.uiuc.edu> fso10235@uxa.cso.uiuc.edu writes: >In your example, you state that E is an "array" and >then go on to talk about &E. > >E is actually an address itself.... This is in K&R, I believe. No: look again. If E is declared as an array, then E is actually an array. It is true that it is *converted* to a pointer to the first element of that array *in rvalue contexts*. The targets of `sizeof' and `&' are not in rvalue contexts. The full list of special contexts, if I remembered them all, is sizeof unary-& lhs of = += -= *= /= %= <<= >>= &= |= ^= operand of ++ -- lhs of `.' (structure selector---actually a special case of `&') Of these, only `sizeof' does not give lvalue context (sizeof accepts either lvalues or rvalues, or, with parentheses, types). Not surprisingly, sizeof is also the only place in this list that accepts an array designator. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris