当前位置:网站首页>02.01-----The role of parameter reference "&"
02.01-----The role of parameter reference "&"
2022-08-05 05:24:00 【A long way to go】
The effect of parameters of the reference“ & ”
To modify parameters need to bring back,Then use quotation marks “&”
无参数的引用“ & ”
#include <iostream>
using namespace std;
void test(int x){
x=1024;
printf("test函数内部 x=%d\n",x);
}
int main(){
int x=1;
printf("调用test前 x=%d\n",x);
test(x);
printf("调用test后 x=%d\n",x);
}
调用test前 x=1
test函数内部 x=1024
调用test后 x=1
Using the parameters of reference“ & ”
#include <iostream>
using namespace std;
void test(int &x){
x=1024;
printf("test函数内部 x=%d\n",x);
}
int main(){
int x=1;
printf("调用test前 x=%d\n",x);
test(x);
printf("调用test后 x=%d\n",x);
}
调用test前 x=1
test函数内部 x=1024
调用test后 x=1024
边栏推荐
- [cesium] 3D Tileset model is loaded and associated with the model tree
- Distributed systems revisited: there will never be a perfect consistency scheme...
- 学习总结week3_4类与对象
- Qt制作18帧丘比特表白意中人、是你的丘比特嘛!!!
- redis复制机制
- day8字典作业
- Pycharm中使用pip安装第三方库安装失败:“Non-zero exit code (2)“的解决方法
- 【过一下6】机器视觉视频 【过一下2被挤掉了】
- DOM及其应用
- redis persistence
猜你喜欢
第四讲 反向传播随笔
Flutter真机运行及模拟器运行
Flutter real machine running and simulator running
Flex layout frog game clearance strategy
Wise Force Deleter强制删除工具
Structured light 3D reconstruction (1) Striped structured light 3D reconstruction
"Recursion" recursion concept and typical examples
NodeJs接收上传文件并自定义保存路径
LeetCode: 1403. Minimum subsequence in non-increasing order [greedy]
The underlying mechanism of the class
随机推荐
flex布局青蛙游戏通关攻略
学习总结week2_3
学习总结week3_4类与对象
2022 Hangzhou Electric Multi-School 1st Session 01
day7-列表作业(1)
【记一下1】2022年6月29日 哥和弟 双重痛苦
jvm three heap and stack
Flex layout frog game clearance strategy
[Go through 7] Notes from the first section of the fully connected neural network video
【过一下4】09-10_经典网络解析
Returned object not currently part of this pool
What are the characteristics of the interface of the physical layer?What does each contain?
Mysql5.7 二进制 部署
Xiaobai, you big bulls are lightly abused
Machine Learning (2) - Machine Learning Fundamentals
2022牛客多校第四场C.Easy Counting Problem(EGF+NTT)
Using pip to install third-party libraries in Pycharm fails to install: "Non-zero exit code (2)" solution
The mall background management system based on Web design and implementation
学习总结week2_4
【过一下12】整整一星期没记录