Reply embedded..
-----Original Message----- From: Madhukar mythri [mailto:[EMAIL PROTECTED] Sent: Monday, December 27, 2004 10:20 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: (PT) Re: Diff b/w global & external variable's?? >If you declare a variable in A.c file, and in B.c file (which is going >to be part of the executable), you try to access that variable, your >attempt will fail (compiler will give an error) unless you declare that >variable as extern in B.c. Of course if you include the >declaration in A.H and include A.h in both A.c and B.c >you will succeed. So, extern type is mandatory >where you are using a variable which is declared in a different scope. >If you just declare a variable as extern but don't have the actual >definition in one of the files in the excutable, the linker will throw >an error. Yeah u r correct only... but, please try it practically... its not giving any error .... its same with & without extern type declaration.. please execute the attached file... >>>>>>>> i had declared a variable "int i" in t1.c file.. -----> In this case you will be able to access because you have included t1.c in t2.c. Don't include, then you will need the extern declartion in t2.c. and included in t2.c and im able to accessing the variable "i" with & without the declaration of "extern int i" in t2.c file.... Please execute and see whether i did telling correct or not.... i had executed in Linux(gcc compiler) Rgds Madhukar ________________________________________________________________________ Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony ------------------------ 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=4865 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/
