Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!bu.edu!mirror!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Difference between "char *arr" and "char arr[]" Message-ID: <18183@haddock.ima.isc.com> Date: 25 Sep 90 03:36:44 GMT References: <8103@aggie.ucdavis.edu> <26680@mimsy.umd.edu> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 16 In article enag@ifi.uio.no (Erik Naggum) writes: >Rather, "char arr[14]" declares an array, but "extern char arr[]" only >declares that "arr" is some constant pointer the value of which is to >be resolved by the linker. I disagree. Both are *declarations*; the one without "extern" happens to also serve as a *definition*. So I would say that "char arr[14]" declares an array and (being a definition) also causes storage to be allocated for it (probably by a linker), while "extern char arr[]" declares an array and causes the name "arr" to be associated with the same storage that was allocated under that name in some other compilation unit. There are no pointers (in the C sense) involved here, at least not until such time as the name "arr" is used in an rvalue context. Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint