Created
September 14, 2018 17:14
-
-
Save dibakarsutradhar/e44a3bf623cd271f9a4c2962d27fd43f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment