Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.UUCP (Conor P. Cahill) Newsgroups: comp.lang.c Subject: Re: question about scope & linkage Keywords: scope, linkage Message-ID: <1001@virtech.UUCP> Date: 11 Aug 89 00:15:58 GMT References: <57257@tut.cis.ohio-state.edu> Distribution: na Organization: Virtual Technologies Inc Lines: 19 In article <57257@tut.cis.ohio-state.edu>, cml@giza.cis.ohio-state.edu (Christopher Lott) writes: > > I am asking about the scope and declaration of a variable; I have > read K&Rv2, p. 227-228, Scope and Linkage, but can't seem to dig out > the answer. (what is a 'translation unit' ??) > 1. I believe a translation unit is a .c file. 2. Definitions of global data elements: real definition: a declaration with an initialization tentative definition: a declaration without an initialization A global symbol may have unlimited tentative definitions, but only 1 real definition. In other words, you can have "int i;" in every .c and they will all refer to the same data space. You can even have "int i=3;" in one (but only one) of the source files and they will still refer to the same data space. But if you have more than one "int i=2;", even if you set the initial value to the same value, the loader (ld) will complain about multipley defined symbols.