This seems very trivial but a somewhat rigorous explanation for the following behavior will help my understanding of extern
a lot.So I\'ll appreciate your answe
Why are we allowed to declare an extern variable inside a function,without any warning or error?If valid,what exactly does it mean?
Ans:- we can use extern at functional level, to expose it only during the scope of that function.
Since we declared x as extern inside the function and it showed no error,why then this declaration doesn't link to the definition of the variable inside the function,but looks outside,when the variable is defined outside? Is conflicting storage-class declaration auto-vs-extern the reason for this?
Ans:Variables declared at block scope (i.e. local variables) have no linkage, unless they are explicitly decalred as extern.