1 #include<iostream> 2 using namespace std; 3 4 static int n; //定義靜態全局變量 5 6 void fn() 7 { 8 n++; 9 cout<<n<<endl; 10 } 11 12 int main(void) 13 { 14 n = 20; 15 cout<<n<<endl; 16 fn(); 17 return 0; 18 }