daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. // global variables
  4. int global = 10;
  5.  
  6. void globalDisplay() {
  7.    
  8.     // global variable accessed from within a function
  9.     std::cout << global << std::endl;
  10.    
  11. }
  12.  
  13. // main function
  14. int main() {
  15.     globalDisplay();
  16.    
  17.     // changin the value of global variables
  18.     global = 5;
  19.     globalDisplay();
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top