#include <iostream>
using namespace std;
void cude();
int main()
{
extern int x;//去掉extern及本行全删除会怎样?
x=5; //去掉这一句呢?
cude();
cout<<x<<endl;
return 0;
}
int x=10;
void cude()
{
x=x*x*x;
}
#include <iostream>
using namespace std;
void cude();
int main()
{
x=5; //去掉这一句呢?
cude();
cout<<x<<endl;
return 0;
}
int x=10;
void cude()
{
x=x*x*x;
}
F:\新建文件夹 (3)\dishierzhouxiangmuer(2-1)\main.cpp|6|error: 'x' was not declared in this scope|
#include <iostream>
using namespace std;
void cude();
int main()
{
int x;//去掉extern及本行全删除会怎样?
x=5; //去掉这一句呢?
cude();
cout<<x<<endl;
return 0;
}
int x=10;
void cude()
{
x=x*x*x;
}
为什么是5呢?全局。。。。局部。。。。。。变量。。。。。。。