Article View: comp.sys.amiga.tech
Article #251Re: Can you nest subroutines in C?
From: Kevin Klop
Date: Thu, 29 Jun 1989 14:31
Date: Thu, 29 Jun 1989 14:31
31 lines
1618 bytes
1618 bytes
In article <25874@agate.BERKELEY.EDU> mwm@eris.berkeley.edu (Mike (I'll think of something yet) Meyer) writes:
>>> In fact, if you declare a function (or a variable external to a function)
>>> to be static, it will be local to the source file but global to all functions
>>> within that file.
>
>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. And an external variable
>declared in a function only has function scope in ANSI C. In pre-ANSI
>C, the scope wasn't explicitly defined, and PCC based compilers gave
>it file scope.
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();
-- 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:
<7173@cbmvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!oliveb!amiga!cbmvax!kevinReferences:
<4495@crash.cts.com> <25874@agate.BERKELEY.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!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: <7173@cbmvax.UUCP> Date: 29 Jun 89 14:31:59 GMT References: <4495@crash.cts.com> <25874@agate.BERKELEY.EDU> Reply-To: kevin@cbmvax.UUCP (Kevin Klop) Organization: Commodore Technology, West Chester, PA Lines: 31