Global variable and extern variable are almost same but only one difference that is scope of variable can be controlled by user in extern variable. Global variable A global variable is a variable that is defined outside of all functions and it is available to all functions. These variables are unaffected by scopes and are always visible to functions and files, which means that a global variable exists until the program ends. global variable are variables which are declared above the main( ) function. These variables are accessible throughout the program. They can be accessed by all the functions in the program. Their default value is zero. Extern Variable It is possible to create a global variable in one file and access it from another file. In order to do this, the variable must be declared in both files, but the keyword extern must precede the "second" declaration. A particular extern variable can be declared many times but we can initialize at only one t
ALL ABOUT TECHNOLOGY,andthinker embedded tutorials and IOT tutorials ,interview questions