0
点赞
收藏
分享

微信扫一扫

局部变量及全局变量

凉夜lrs 2022-01-31 阅读 75
#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 条评论