Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!agate!dog.ee.lbl.gov!nosc!manta!grantk From: grantk@manta.NOSC.MIL (Kelly J. Grant) Newsgroups: comp.lang.c Subject: external definition problems... Message-ID: <2080@manta.NOSC.MIL> Date: 26 Jun 91 15:02:17 GMT Article-I.D.: manta.2080 Organization: Computer Sciences Corporation Lines: 23 I'm working on 4.2BSD on a Sun. In one module I have a character array declared, 'char foo[20+1];'. In another module, I refer to foo using extern, ie.,'extern char *foo', and then attempted to use it in a printf(), which summarily caused a core dump. When I changed the reference to 'extern char foo[]', it worked properly. K&R2 does not seem to address this directly. I read about external definitions in the appendix, and the entire pointer chapter, but it does not reference this exact situation. Does anyone out there have a good explanation why the char * failed ? I know that a pointer can be treated differently (ie, incremented), but as an argument to a function it should not matter. What is actually occurring during the failure ? Many thanks in advance Kelly -- Kelly Grant grantk@manta.nosc.mil (619) 225-2508 Computer Sciences Corp ^^^^^^^^ Important: manta.UUCP won't get to me 4045 Hancock Street "If you are given lemons.....see if you can trade for San Diego, CA 92110 chocolate" - me