Skip to content

Instantly share code, notes, and snippets.

@elarkin
Last active December 13, 2015 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elarkin/4955920 to your computer and use it in GitHub Desktop.
Save elarkin/4955920 to your computer and use it in GitHub Desktop.
If statements introduce scope.
#include <stdio.h>
int main()
{
int foo = 4;
if(1) {
int foo = 5;
printf("%i", foo);
}
printf("%i", foo);
}
//The output will be 54 instead of 55 since scope is introduced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment