首页 > 其他 > 详细

extern

时间:2014-03-19 17:52:32      阅读:417      评论:0      收藏:0      [点我收藏+]

只要当处于函数外的声明时才能初始化

函数内的不能

 

函数内的extern 变量不能初始化

下面是例子

void f1(){

  extern int a;

}

 

void f2(){

  int a=100;

}

 

关于引用

const int a =100;

const int & b = a;常量引用只能是指向常量的引用

 

int c = 1000;

int &d = c;非常量的引用只能指向非常量的引用

extern,布布扣,bubuko.com

extern

原文:http://www.cnblogs.com/ccccccccc/p/3611743.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!