Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- // global variables
- int global = 10;
- void globalDisplay() {
- // global variable accessed from within a function
- std::cout << global << std::endl;
- }
- // main function
- int main() {
- globalDisplay();
- // changin the value of global variables
- global = 5;
- globalDisplay();
- }
Add Comment
Please, Sign In to add comment