Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bbn!uwmcsd1!mrsvr!roth From: roth@mrsvr.UUCP (Dean Roth) Newsgroups: comp.lang.c Subject: Re: static stuff... Message-ID: <235@mrsvr.UUCP> Date: Wed, 18-Nov-87 09:55:29 EST Article-I.D.: mrsvr.235 Posted: Wed Nov 18 09:55:29 1987 Date-Received: Sat, 21-Nov-87 04:53:25 EST References: <3011@sigi.Colorado.EDU> Organization: GE Medical, MR Center, Milwaukee Lines: 16 In article <3011@sigi.Colorado.EDU>, swarbric@tramp.Colorado.EDU (SWARBRICK FRANCIS JOHN) writes: > First, what is the significance of making a static function? > > Second, aren't all global variables automatically static. Is there any > reason to explicitly call them static? > > swarbric@tramp.UUCP Global and static global (extern) variables are not the same thing. A static global can only be referenced by code in the same source code file. A non-static global can be referenced by any function, even if it is in a different source file and separately compiled and linked. One reason to declare a global variable static is to restrict its scope- only functions in that same source file can reference the variable.