Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!rutgers!bellcore!clyde!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Mutually recursive functions in C Message-ID: <11750@haddock.ima.isc.com> Date: 13 Feb 89 19:58:44 GMT References: <34823@tut.cis.ohio-state.edu> <447@thirdi.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Distribution: usa Organization: Interactive Systems, Boston Lines: 19 In article <447@thirdi.UUCP> peter@thirdi.UUCP (Peter Rowell) writes: >william@cis.ohio-state.edu (James H. Williamson) writes: >>Does C allow mutually recursive functions... > >[Yes.] If the routines return anything other than "int" (or if you are using >ANSI C with prototypes), you will need to place an extern declaration in the >front of the file so that the compiler doesn't bitch about "Redeclaration of >procedure Foo"... Or, if the routines are intended to be local, then you should forward-declare them using `static' (and hope your compiler isn't one of the broken ones that can't handle this): static ftype_t f(); static gtype_t g(); ... static ftype_t f() { ... g(); ... } static gtype_t g() { ... f(); ... } Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint