Article View: comp.sys.amiga.tech
Article #253Re: Can you nest subroutines in C?
From: Mike (I'll think of something ye...
Date: Thu, 29 Jun 1989 19:49
Date: Thu, 29 Jun 1989 19:49
39 lines
1922 bytes
1922 bytes
In article <7173@cbmvax.UUCP> kevin@cbmvax.UUCP (Kevin Klop) writes:
<In article <25874@agate.BERKELEY.EDU> mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) writes:
<>Not quite. C (like many other languages) reqiures forward
<>declarations. Functions and variables are only visible to code that
<>occurs after their decleration in the file.
<
<Excuse me, I beg to differ. If you do not declare a function before you
<use it, then it is of type ``int'' with a globale scope. Try this sometime:
<
<main()
<{
< MyFunction();
<}
<
<char MyFunction();
Well, you implicitly declared the function when you used it's name in
a place that required a function invocation. And it's _still_ only
visible to things after that point in the file.
If you used MyFunction in a place where a function type wasn't
required, then you lose the decleration, and get an "undefined
variable" error.
MyMetaFunciton(MyFunction) ;
This type of implicit decleration is also available for arguments:
main(argc, argv) char **argv;
Will implicitly declare argc as type int.
<mike
--
When logic and proportion have fallen softly dead, Mike Meyer
And the white knight is talking backwards, mwm@berkeley.edu
And the red queen's off her head, ucbvax!mwm
Remember what the dormouse said. mwm@ucbjade.BITNET
Technical Details
Message-ID:
<25899@agate.BERKELEY.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!eris.berkeley.edu!mwmReferences:
<4495@crash.cts.com> <25874@agate.BERKELEY.EDU> <7173@cbmvax.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!eris.berkeley.edu!mwm From: mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) Newsgroups: comp.sys.amiga.tech Subject: Re: Can you nest subroutines in C? Message-ID: <25899@agate.BERKELEY.EDU> Date: 29 Jun 89 19:49:01 GMT References: <4495@crash.cts.com> <25874@agate.BERKELEY.EDU> <7173@cbmvax.UUCP> Sender: usenet@agate.BERKELEY.EDU Reply-To: mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) Organization: Missionaria Phonibalonica Lines: 39