Last active
November 16, 2017 15:18
-
-
Save me-shaon/8e9ab8688ce4cb357bc99c520ce6fe62 to your computer and use it in GitHub Desktop.
Sample Block Scope example for Medium article
This file contains hidden or 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
void testFunction() { //Scope 1: Starts here. This scope is created by the Function block | |
int a = 1; | |
if(true) { //Scope 2: Starts here. This scope created by the 'if' block | |
int b = 2; | |
//a is available here, because it is inside of it's scope | |
printf("%d %d", a, b); | |
}//Scope 2: Ends here | |
//'b' is not available here, because it is out of it's scope | |
} //Scope 1: Ends here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment