Please refer to the following code that is in the same translation unit:
static int global_var; // file scope in C and global namespace scope in C++
Generally static
variables have internal linkage. You can't access the static
variable or function in another file(in multiple file compilation situations), because its scope limited within this file(Internal linkage).
Normally auto
and register
variables have no linkage.
As i said above auto
and register
variables have no linkage. You can't declare these variables in global scope. static
variables has internal linkage, scope is based on declaration, but not possible to access in another file. extern
variables has external linkage, its possible to access these variables in another file.
For more reference Storage classes