Google News
logo
C-Language - Interview Questions
What is Global variable in C ?
Global variable is defined at the top of the program file and it can be visible and modified by any function that may reference it.

Global variables are initialized automatically by the system when you define them.

If same variable name is being used for global and local variable then local variable takes preference in its scope. But it is not a good practice to use global 

variables and local variables with the same name.

Example :
  int value=20; //global variable  
  void function1()
   {  
     int x=10; //local variable  
   }
Advertisement