加文

希望是美好的……
随笔 - 0, 文章 - 209, 评论 - 0, 引用 - 0

导航

<2025年4月>
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

常用链接

留言簿

文章分类

文章档案

相册

搜索

  •  

最新评论

作用域问题

变量是否为const变量,没有影响。
/*

* main.cpp
*/
#include <string>
#include <iostream>
using namespace std;
extern int a ;
void show();
int main()
{
    cout<<a<<endl;
    show();
    getchar();
    return 0;
}

int a = 10;


/*
* test.cpp
*/
#include <iostream>
extern int a ;
void show()
{
    a  = 210;
    std::cout<<a<<std::endl;
}

posted on 2012-03-26 17:51 加文 阅读(73) 评论(0)  编辑 收藏 引用 所属分类: C++


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理