Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: char (*a)[] Message-ID: <994@haddock.ISC.COM> Date: Mon, 24-Aug-87 12:39:37 EDT Article-I.D.: haddock.994 Posted: Mon Aug 24 12:39:37 1987 Date-Received: Tue, 25-Aug-87 04:05:53 EDT References: <8942@brl-adm.ARPA> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 24 In article <8942@brl-adm.ARPA> DHowell.ElSegundo@Xerox.COM writes: >char (*a)[10]; char b[10]; a = &b; > >However, as I understand it, b is actually &b[0], A better way to state this rule is something like "the array-valued expression b, if used in a rvalue context, will automatically be converted to the pointer-valued expression which is conceptually &b[0]". Since the premise is false, the rule does not apply in this situation. (Others have already mentioned that PCC interprets &b as a typo for b, and that ANSI has fixed this, making the above code legal and useful.) >What exactly does a point to? Does it point to the first element of an >array? Does it point to a descriptor of an array? As stated by its declaration, a points to an array. Thus, if you dereference it, you get an array (which, if used in an rvalue context, will be converted to a pointer). Your other two questions don't make sense, unless you rewrite them as "If I cast a into a different pointer type and dereference it, will I get ...?". In this form, the answers are likely to be "Yes" and "No", respectively; but I strongly discourage that type of code. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint