Article View: comp.sys.amiga.tech
Article #227Re: Can you nest subroutines in C?
From: Kevin Klop
Date: Wed, 28 Jun 1989 09:24
Date: Wed, 28 Jun 1989 09:24
30 lines
1549 bytes
1549 bytes
In article <14753@watdragon.waterloo.edu> sjorr@rose.waterloo.edu (Stephen Orr) writes:
> Unless someone changed the definition of C that I learnt, all
>modules in 'C' have the same visibility even main(). This does not mean you
>can't get your peice of code running, it just means that the sub-module you
>would place with a larger module will be visible to all modules in the program.
>
Actually, if you're willing to break things up into separate compilation units
(i.e. files), nested subroutines can be emulated (to alevel of 1 deep.
File : NestedRtns.c
static int FunctionInvisibleOutsideThisFile()
.
.
.
Note that the static keyword in most cases prevents any function outside the
current file from seeing the static function.
-- Kevin --
Kevin Klop {uunet|rutgers|amiga}!cbmvax!kevin
Commodore-Amiga, Inc.
The number, 111-111-1111 has been changed. The new number is:
134-253-2452-243556-678893-3567875645434-4456789432576-385972
Disclaimer: _I_ don't know what I said, much less my employer.
Technical Details
Message-ID:
<7152@cbmvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sdsu!usc!apple!oliveb!amiga!cbmvax!kevinReferences:
<4470@crash.cts.com> <14753@watdragon.waterloo.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sdsu!usc!apple!oliveb!amiga!cbmvax!kevin From: kevin@cbmvax.UUCP (Kevin Klop) Newsgroups: comp.sys.amiga.tech Subject: Re: Can you nest subroutines in C? Message-ID: <7152@cbmvax.UUCP> Date: 28 Jun 89 09:24:44 GMT References: <4470@crash.cts.com> <14753@watdragon.waterloo.edu> Reply-To: kevin@cbmvax.UUCP (Kevin Klop) Organization: Commodore Technology, West Chester, PA Lines: 30