Created
August 22, 2014 08:12
-
-
Save yuanqing/c5d4fdb2859a34f971e9 to your computer and use it in GitHub Desktop.
ANSI C: Variable Shadowing
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 <stdio.h> | |
int main() | |
{ | |
int i = 1; | |
printf("%d\n", i); //=> 1 | |
{ | |
printf("%d\n", i); //=> 1 | |
int i = 2; | |
printf("%d\n", i); //=> 2 | |
} | |
printf("%d\n", i); //=> 1 | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment