External variable
As the name suggest , they are external to any function which means they are defined always outside of any function. Actually when you declare the external variable (declaration can be inside of any function or outside) you make a promise with your compiler that you have defined that variable somewhere outside of any function.
first it's good to know what does it mean by Declaration and Definition.
Extern int a; is actually a declaration. Declaration is just a hint to compiler that this kind of variable/function may be use somewhere so better you know about it now. Memory is not allocated during declaration.
Extern int a=5; is actually definition but as its external variable, you can't use it inside any function. where ever outside you define extern variable , its responsibility of linker to find it and use it. Variables declared inside some function or block (i mean to say local variable)have No Linkage. You make then extern and put the definition outside blocks and linker will find then for those who need that extern variable at linking time.
In you program the linker won't be able to find definition of your declared extern variable (as you didn't define it outside and linker only search outside , in that way only linker works) so it's okay no problem , no error would be there (either it's bad programming) so ultimately there is no memory allocated for your variable. but the tragedy is you defined extern variable inside some function so here compiler would catch it at compiling time and will think , there is even no memory is allocated for that variable and some superman is trying to update its value. Compiler would say to itself ohh someone is making fun of me as he is saying me to update a variable which even don't exists :)
hope you get it tell me if more i can tell you.