Guest User

Untitled

a guest
Sep 14th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment