//?file1.cpp
#include?<iostream>
using?namespace?std;
void?other();
void?another();
int?x?=?10;
int?y;
int?main()
{
?cout?<<?x?<<?endl;
?{
??int?x?=?4;
??cout?<<?x?<<?endl;
??cout?<<?y?<<?endl;????????//這里y為什么輸出0?
?}
?other();
?another();
?return?0;
}
void?other()
{
?int?y?=?1;
?cout?<<?"Other:?"?<<?x?<<?",?"?<<?y?<<?endl;
}
//?file?2.cpp
#include?<iostream>
using?namespace?std;
extern?int?x;
namespace
{
int?y?=?-4;
}
void?another()
{
cout?<<?"another():?"?<<?x?<<?",?"?<<?y?<<?endl;
}
- 1 回答
- 0 關(guān)注
- 1208 瀏覽
添加回答
舉報(bào)
0/150
提交
取消