Local and Global Variables in C
Local Variables: 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: Variables are declared outside the body of the main program, these type variables are called Global Variables.
int x, y, i,j; // Global variables void main() { float a[3][3]; ---------- ---------- ---------- } int test(float b[][]) { int k; ---------- ---------- ---------- }