#include<iostream>
#include<string>
using namespace std;
int test_i = 0;
void foo(){
cout << test_i << endl;
}
int main(){
int test_i;
foo();
test_i = 1;
cout << test_i << endl;
foo();
return 0;
}
运行结果:
0
1
0
局部变量及全局变量
阅读 73
2022-01-31
#include<iostream>
#include<string>
using namespace std;
int test_i = 0;
void foo(){
cout << test_i << endl;
}
int main(){
int test_i;
foo();
test_i = 1;
cout << test_i << endl;
foo();
return 0;
}
运行结果:
0
1
0
相关推荐
精彩评论(0)