what is the difference between extern and global variable?
If a variable is defined globally, there should be a way to tell compiler about possible global variables (or functions) that we may encounter. Keyword extern is present exactly for the same reason. ... If a variable is global, you can access it in any compilation unit (commonly called source file, module etc.)