1 Star 0 Fork 0

Admin / text_cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
yinyong.cpp 483 Bytes
一键复制 编辑 原始数据 按行查看 历史
Admin 提交于 2024-04-18 22:39 . 引用等基础语法点
#include <iostream>
using namespace std;
void Swap(int& x, int& y)
{
int tmp = x;
x = y;
y = tmp;
}
int main()
{
/*int x = 3, y = 4;
cout << x <<" " << y << endl;
Swap(x, y);
cout << x <<" " << y << endl;
*/
const int x = 3;
//int& y = x;权限的放大
int y = 3;
const int& z = y; //权限的缩小
int& d = y;//权限的平移
//辨析引用,以及赋值
const int a = 1;
const int& b = a;//引用,b作为a的别名。
int c = a;//把a的值赋值给c。并不会造成权限的放大!!!
return 0;
}
1
https://gitee.com/small-c_2_0/text_cpp.git
git@gitee.com:small-c_2_0/text_cpp.git
small-c_2_0
text_cpp
text_cpp
master

搜索帮助