+ 6
What are global variables?
What are global variables? How are these variable declared and what are the problems associated with using them?
2 Respostas
+ 4
Global variables are the variables that can be accessed from anywhere inside the program for example
int a=1;//Globally declared variable
int main()
{
int b=2;
{
int c=3;
}//variable c can be used in this scope only
cout<<a;//outputs 1
cout<<b;//outputs 2
cout<<c;//gives error
return 0 ;
}
Happy coding...
0
intresting