I read it in C programming (Dennits M. Ritchie) and Microsoft (http://msdn.microsoft.com/en-us/library/z4ew7daa.aspx), that Extern variables are not visible (cannot be accessed) in main.
This is confusing, as I have used following technique many times.
#include<stdio.h>
int sp = 99; //extern variable
int main(){
printf("sp is :%d",sp); //not visible?
sp = 98;
printf("sp is :%d",sp); //ofcourse it is visible!
}
Your link has this code
int main() {}
int var = 0;
double val[MAXVAL];
char find( fileptr ) {}
int count( double f ) {}
And then proceeds to say var and val are not available in main. That is because they are declared AFTER main.
It has nothing to do with extern variables. Only order of declaration.
Update. The photo is saying the exact same thing. The order in which they appear in the file determines their visibility.
The reason the variables are not visible in main has to do with the order in which they appear in the file. They come AFTER main.
The photo says, "The scope of an external variable or a function lasts from the point at which it is declared to the end of the file being compiler.".
It says nothing about extern variables not being visible in main.