<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META content='"MSHTML 4.72.3110.7"' name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#000000>dear techies,</FONT></DIV>
<DIV><FONT color=#000000> </FONT></DIV>
<DIV><FONT color=#000000>hope the list has settled down
</FONT></DIV>
<DIV><FONT color=#000000>but a doubt has unsettled me</FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#000000>consider the snippet</FONT></DIV>
<DIV><FONT color=#000000></FONT> </DIV>
<DIV><FONT color=#000000><STRONG>extern int i;</FONT></STRONG></DIV>
<DIV><FONT color=#000000><STRONG></FONT>main()</STRONG></DIV>
<DIV><STRONG>{</STRONG></DIV>
<DIV><STRONG> <FONT
color=#000000>printf("%d",i);</FONT></STRONG></DIV>
<DIV><FONT color=#000000><STRONG>}</FONT></STRONG></DIV>
<DIV><FONT color=#000000>gcc obvious shouts at me because the first line a
declaration and it cannot link to a definition</FONT></DIV>
<DIV><FONT color=#000000>ok , but see this code</FONT></DIV>
<DIV><FONT color=#000000></FONT> </DIV>
<DIV>
<DIV><FONT color=#000000><STRONG>extern int i=100;</FONT></STRONG></DIV>
<DIV><FONT color=#000000><STRONG></FONT>main()</STRONG></DIV>
<DIV><STRONG>{</STRONG></DIV>
<DIV><STRONG> <FONT
color=#000000>printf("%d",i);</FONT></STRONG></DIV>
<DIV><FONT color=#000000><STRONG>}</FONT></STRONG></DIV></DIV>
<DIV> </DIV>
<DIV><FONT color=#000000>eventhough there is no definition to link with , it
gets initialised and works well. </FONT></DIV>
<DIV><FONT color=#000000></FONT> </DIV>
<DIV>but if i put the first statement into the main block like the following
</DIV>
<DIV> </DIV>
<DIV>
<DIV>
<DIV><STRONG>main()</STRONG></DIV>
<DIV><STRONG>{</STRONG></DIV>
<DIV><STRONG></STRONG>
<DIV><FONT color=#000000><STRONG> extern int
i=100;</FONT></STRONG></DIV></DIV>
<DIV><STRONG> <FONT
color=#000000>printf("%d",i);</FONT></STRONG></DIV>
<DIV><FONT color=#000000><STRONG>}</FONT></STRONG></DIV></DIV>
<DIV> </DIV>
<DIV>i get the error message.</DIV>
<DIV> </DIV>
<DIV>how can this phenomenon be explained? how do the storage classes work
internally???</DIV>
<DIV> </DIV>
<DIV> </DIV></DIV>
<DIV><FONT color=#000000>Regards, <BR>Srinath
Thiruvengadam<BR></FONT></DIV></BODY></HTML>