The difference between global and extern variables are very subtle. To
understand the clear meaning one needs to understand the terms like
"Linkage", storage classes etc.
By default the names of variables are made visible to the linker(
External Linkage). If the name has to be restricted to a particular
translational unit, then we have to prefix the declaration with
static(Internal Linkage).
int i; // This is the definition of a global variable with external
linkage.It is defined in the current Translational unit, so you can
say internal definition.
static int i; // Internal definition, internal linkage.
extern int i; // External definition, external linkage.
const int i = 5;// Internal Linkage
extern const int i = 5;// External Linkage
A name with internal linkage must also have internal definition( be
defined in the same translational unit where it is declared ).
Bijesh
-----Original Message-----
From: deo sharma [mailto:[EMAIL PROTECTED]
Sent: Monday, December 27, 2004 9:31 AM
To: [EMAIL PROTECTED]
Subject: RE: (PT) Diff b/w global & external variable's??
can youn please explain where exactly is memory allocated for the
external variables.is it allocated where it has been stored or it is
where it has been used.moreover to use external variables you use extern
statements and not #include statements.
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/Programmers-Town/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
To unsubscribe : [EMAIL PROTECTED]
Yahoo! Groups Sponsor
ADVERTISEMENT
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/Programmers-Town/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------------------------ Yahoo! Groups Sponsor --------------------~-->
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~->
To unsubscribe : [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To reply to this message, go to:
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=4891
Please do not reply to this message via email. More information here:
http://help.yahoo.com/help/us/groups/messages/messages-23.html
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Programmers-Town/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/