Skip to content

Instantly share code, notes, and snippets.

@yuanqing
Created August 22, 2014 08:12
Show Gist options
  • Save yuanqing/c5d4fdb2859a34f971e9 to your computer and use it in GitHub Desktop.
Save yuanqing/c5d4fdb2859a34f971e9 to your computer and use it in GitHub Desktop.
ANSI C: Variable Shadowing
#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