external definition problems...
Kelly J. Grant
grantk at manta.NOSC.MIL
Thu Jun 27 01:02:17 AEST 1991
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 at 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
More information about the Comp.lang.c
mailing list