Re: external variables
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Wed, 11 Feb 2009 18:10:07 -0800
Larry Gates <larry@xxxxxxxxxxxxxxx> writes:
On Tue, 10 Feb 2009 07:54:55 -0500, pete wrote:
Also, you can have a declaration with the extern keyword
inside of a function definition.
Well, if you can't declare a function from within a function, what use is
the keyword extern going to do you there?
You can't *define* a function within a function definition:
void outer(void) {
void inner(void) { } /* ILLEGAL */
}
You can *declare* a function within a function definition:
void func(void) {
extern void external_function(void); /* OK */
}
but it's no necessarily a good idea. Normally function declarations
like this (prototypes) should be in header files, not buried inside
function definitions.
--
Keith Thompson (The_Other_Keith) kst@xxxxxxx <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- Follow-Ups:
- Re: external variables
- From: Larry Gates
- Re: external variables
- References:
- external variables
- From: Larry Gates
- Re: external variables
- From: pete
- Re: external variables
- From: Larry Gates
- external variables
- Prev by Date: Re: external variables
- Next by Date: Re: c to c++
- Previous by thread: Re: external variables
- Next by thread: Re: external variables
- Index(es):
Relevant Pages
|