Quote Originally Posted by sleax View Post
Ok, now it's clear. Just one thing:
I can update the value of a also without using the extern keyword. Why?
The extern keyword is only necessary at declaration, not for each usage. This is "by design". You only need to declare something (describe it to the compiler) once per scope. This is the same reason you don't have to repeat the type every time you use a variable, like int x; int x++; int x = 3*y + 7; Furthermore, this would confuse the compiler, are you trying to redefine/redeclare something, or simply use it?

You already told the compiler once that the definition of a (it's location, where the contents are stored) is external to this translation unit. Everything in main.c will use something like a temporary holding address when it's compiled, then when the linker comes along, it will see the real definition of a, and change all the temporary holding addresses in main to the real address of a.