Question: what is the difference between global and extern variable in c?
Answer: A global variable in C/C++ is a variable which can be accessed from any module in your program. int myGlobalVariable; ... extern int myGlobalVariable; This tells the compiler "there's a variable defined in another module called myGlobalVariable, of type integer.