#include void main(void). void main() { / * Begin local block for function main() * / int test_ var = 10. printf("Test variable before the if statement: %d\n", test_var). if (test_var>5) { / * Begin local block for "if" statement * / int test_ var = 5. printf("Test variable within the if statement: %d\n", test_var). { / * Begin independent local block (not tied to any function or keyword) * / int test_var = 0. printf ( "Test variable within the independent local block: %d\n", test_var) } / * End independent local block * / printf ("Test variable after the if statement: %d\n", test_var). } /*End local block for function main () * /
上例产生如下输出结果:
Test variable before the if statement: 10 Test variable within the if statement: 5 Test variable within the independent local block:0 Test variable after the if statement: 10