#include <iostream.h>
int fun(int);
void main()
{ int a(3);
static int b;
b+=fun(a);
cout<<"a="<<a<<",b="<<b<<endl;
b+=fun(a);
cout<<"a="<<a<<",b="<<b<<endl;
}
static int a=10;
int fun(int x)
{ static int b(5);
b+=a;
cout<<"a="<<a<<",b="<<b<<endl;
return b;
}
#include <iostream>
using namespace std;
int fun(int);
int main()
{ int a(3);
static int b;
b+=fun(a);
cout<<"a="<<a<<",b="<<b<<endl;
b+=fun(a);
cout<<"a="<<a<<",b="<<b<<endl;
getchar();
}
static int a=10;
int fun(int x)
{ static int b(5);
b+=a;
cout<<"a="<<a<<",b="<<b<<endl;
return b;
}
运行结果;