C++中int a和int& a的区别

标题C++中int a和int& a的区别

int a的意思是定义一个变量a
int &a意思是定义一个引用
//引用相当于指针再取值 他和被引用的变量都是表示同一块内存

引用就是给变量取别名 int b ;int &a=b; 用cout<<&a 和cout<<&b 你会发现他们的地址是一样的##

猜你喜欢

转载自blog.csdn.net/weixin_43155866/article/details/84256160
今日推荐