Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!necntc!ima!haddock!karl From: karl@haddock.UUCP (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: static char (*b)[6]; /* an unusual declaration */ Message-ID: <561@haddock.UUCP> Date: Mon, 15-Jun-87 16:17:01 EDT Article-I.D.: haddock.561 Posted: Mon Jun 15 16:17:01 1987 Date-Received: Sun, 21-Jun-87 02:48:20 EDT References: <761@bsu-cs.UUCP> <535@whuxm.UUCP> Reply-To: karl@haddock.ISC.COM.UUCP (Karl Heuer) Organization: Interactive Systems, Boston Lines: 18 Summary: &a != &a[0] in ANSI C >In article <761@bsu-cs.UUCP>, dhesi@bsu-cs.UUCP (Rahul Dhesi) writes: >>[after declaring char (*b)[6]; char **d;] >> b = d; /* So b == d ... Watch. */ In article <535@whuxm.UUCP> davew@whuxm.UUCP (WONNACOTT) writes: >[explains why this is a type mismatch, then says] > b = &a; >would be better in some sense, but most C compilers assume that you >really meant &a[0] if you write &a, and ignore the & ... Fortunately, X3J11 has recognized this translation as bogus. In ANSI C, "&a" means what it says: the address of "a" (with type "pointer to one or more arrays", not "pointer to first element of array"). (A side effect of the bogus translation is that, given char a[M][N], "&a[i]" doesn't work in most pre-ANSI compilers -- you must instead write "a+i".) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint