Local and Global Variables in C

Local Variables in C:

Variables declared inside the body of a function or the main program, these variables are called Local Variables.

Example:

void main()
{
int x, y, i,j; // local variables in main()
float a[3][3];
----------
----------
----------
}
int test(float b[][], int x, int y)
{
int i, j, k; // local variables in function
----------
----------
----------
}

Global Variables in C:

Variables are declared outside the body of the main program, these type variables are called Global Variables.

Example:

int x, y, i,j; // Global variables
void main()
{

float a[3][3];
----------
----------
----------
}
int test(float b[][])
{
int k;
----------
----------
----------
}