This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: extern question


Hi Trevis,

> should I even be allowed to declare "larry" in both foo.c and
> bar.c ?  If so, why is that not seen as a problem?

You can declare larry as many times as you want.  You've declared it in
main.c and in bar.c.

You can only define larry once.  You've defined it in bar.c.

If you change the declaration of larry in bar.c to a definition, then you've
defined it too many times (i.e., more than once).

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]