void fun(){ static int a = 1; a++; cout<<a<<endl;} main 调这个函数两次,输出的值将是2,3 静态变量的生命周期为整个文件,但是可见性为此函数内,因为它是一个局部变量。