[LCP]storage classifiers
T.Srinath
rangar20 at eth.net
Thu Jul 12 22:06:04 UTC 2001
dear techies,
hope the list has settled down
but a doubt has unsettled me
consider the snippet
extern int i;
main()
{
printf("%d",i);
}
gcc obvious shouts at me because the first line a declaration and it cannot link to a definition
ok , but see this code
extern int i=100;
main()
{
printf("%d",i);
}
eventhough there is no definition to link with , it gets initialised and works well.
but if i put the first statement into the main block like the following
main()
{
extern int i=100;
printf("%d",i);
}
i get the error message.
how can this phenomenon be explained? how do the storage classes work internally???
Regards,
Srinath Thiruvengadam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20010712/6afbafe0/attachment.html
More information about the linuxCprogramming
mailing list