Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ncar!ico!ism780c!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: extern char *foo vs. extern char foo[] Message-ID: <16821@haddock.ima.isc.com> Date: 8 Jun 90 01:26:09 GMT References: <1990May30.001219.23564@uunet!unhd> <586@isi.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 17 In article <586@isi.UUCP> mark@isi.UUCP (Mark Bailey) writes: >It is the declarations: > char foo[]; and > char *foo; >which are identical. (K&R 1, p. 95) This is true *only* for the declaration of a pointer as a formal parameter, as the K&R quote says. >The reference manual appears to allow such a declaration which is not >used as a formal parameter (K&R 1, p. 194). Yes, but then they're no longer identical. In this context `char foo[];' declares an array (and it had better be an extern if you're leaving out the size), while `char *foo' declares a pointer. See the FAQ list. Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint