QwertyManiac
Commander in Chief
Re: Post ur C/C++ Programs Here
This ain't a passing area
Anyway global declaration of a variable or function makes it available to be used throughout the program.
See the variable A in the following example:
Running the above would give you a clear example of what global declaration means.
This ain't a passing area
Anyway global declaration of a variable or function makes it available to be used throughout the program.
See the variable A in the following example:
Code:
#include<stdio.h>
int A=10;
void DispA()
{
printf("\nGlobal A used in DispA() = %d",A);
{
int A = 30;
printf("\nLocal A for DispA() = %d",A);
}
}
int main()
{
printf("Global A = %d\n",A);
{
int A = 20;
printf("Local A for Main() = %d\n",A);
}
DispA();
return 0;
}