Global and Extern Pointers, Arrays
Asim Jalis
aj3u at agate.cs.virginia.edu
Thu May 23 11:26:42 AEST 1991
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?
Asim Jalis.
More information about the Comp.lang.c
mailing list