Juan
-1
Q:

how use global variables instead of local in c++

#include<iostream> 
  
using namespace std; 
  
int x;  // Global x 
  
int main() 
{ 
  int x = 10; // Local x 
  cout<<"Value of global x is "<<::x<<endl; 
  cout<<"Value of local x is "<<x;   
  getchar(); 
  return 0; 
} 
1

New to Communities?

Join the community