#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
extern int a = 1;//不允许对外部变量的局部声明使用初始值
return 0;
}
我知道extern int a
这样写是可以的,或者把extern int a = 1
放在全局区也是可以的,但是为什么放在函数内部,例如main()里就报错呢?求解释。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
https://stackoverflow.com/que...
以前我也没注意到