Local variable:-
variables that are defined with in a body of function or block. The local variables can be used only in that function or block in which they are declared. Same variables may be used in different functions such as
function()
{
int a,b;
function 1();
}
function2 ()
{
int a=0;
b=20;
}
Global variable:-
The variables that are defined outside of the function is called global variable. All functions in the program can access and modify global variables. Global variables are automatically initialized at the time of initialization.
Example:
#include
{
"local global and static variables in c"
"difference between static and local variable in c"
"example of global variable in c"
"global static variable in c"
"local static variable in c"
"default value of local variable in c"
"static global variable in c"
"c global variable in header"
"local global and static variables in c"
"local static variable and global static variable in c"
"local static and global static in c"
"local global and static variables"
"local static variable and global static variable"