Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!zaphod.mps.ohio-state.edu!wuarchive!m.cs.uiuc.edu!ux1.cso.uiuc.edu!osiris.cso.uiuc.edu!gordon From: gordon@osiris.cso.uiuc.edu (John Gordon) Newsgroups: comp.lang.c Subject: Re: Global and Extern Pointers, Arrays Message-ID: <1991May23.201029.27372@ux1.cso.uiuc.edu> Date: 23 May 91 20:10:29 GMT References: Sender: usenet@ux1.cso.uiuc.edu (News) Distribution: comp Organization: University of Illinois at Urbana Lines: 23 aj3u@agate.cs.virginia.edu (Asim Jalis) writes: >I just figured out the following bug in my program. I had a global >array, with some initialized value that I was also declared an extern >pointer in the other files that accessing it. This turns out to be a >no-no. The bug went away when I changed the extern definition to an >array also. >Here is the code: >file.1 > struct x px[1] = { ... }; >file.2 > extern *px /* boinks */ > extern px[] /* works */ >Any ideas as to why this is? Arrays and pointers are mostly analogous most of the time. However, this is one of the things about them that are NOT the same. John