/* Code from Mon Sep 25, 2023 Demonstrates that C has file scope, function (local) scope, for loop scope, and block scope */ #include int file = 0; // file level scope void func_a() { file += 1; // block scope { int a = 1; printf( "a = %d\n", a ); } // printf( "a = %d\n", a ); // for loop scope for (int i = 0; i < 3; i++) { int i = 2; // block scope printf( "i = %d\n", i ); } //printf( "i = %d\n", i ); // out of scope } int main( int argc, char* argv[] ) { printf( "file in main at beginning is %d\n", file ); func_a(); printf( "file in main at end is %d\n", file ); return 0; }