理解static的作用

#include<iostream>
using namespace std;

void useStatic(){
    static int x = 10;
    cout << "useStatic x: " << x << endl;
    x++;
    cout << "useStatic x: " << x << endl;
}

void main()
{

    useStatic();
    useStatic();

    getchar();

}

posted @ 2015-06-28 14:44  ROTBLATT  阅读(106)  评论(0编辑  收藏  举报