subblock.cpp

来自「VC源代码大全(精华版)」· C++ 代码 · 共 23 行

CPP
23
字号
#include    <stdio.h>

int x = 1;            // declare a global instance of x
void FunctionOne();   // Prototype our function

main ()
{
    printf ("The global x is %d\n", x);
    FunctionOne ();
    printf ("The global x is still %d\n", x);
}

void FunctionOne ()
{
int x = 2;
    printf ("The local x in the function is %d\n", x);
    {
    int x = 3;
        printf ("The local x in a block is %d\n", x);
    }
    printf ("Block has ended. x = %d\n", x);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?