#include "stdafx.h"
static int a;
int display(int m)
{
static int b=2;//静态局部变量在编译时赋初值,即只赋值一次。运行设置断点可以检验
//int b=0;//函数调用时赋值,必须初始化
b = b + m;
return b;
}
int _tmain(int argc, _TCHAR* argv[])
{
int c;
a = 3;
printf("%d
",a);
c = display(a);
printf("%d
",c);
c = display(a);
printf("%d
",c);
getchar();
return 0;
}