#include static int foo = 10; // This variable lives in global scope int main(int argc, const char *argv[]) { int bar = 55; // This is in the scope of the main function for(int i= 0; i < 10;) i += 1; // i is local to this scope for(int i = 10; i >= 0;) i -= 1; // so we can reuse i again // you can open a block to introduce a scope { int foo = 5; // this will overshadow the global foo printf("foo: %d\n", foo); } printf("foo: %d\n", foo); }