当前位置:网站首页>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
边栏推荐
- 【记一下1】2022年6月29日 哥和弟 双重痛苦
- 1.3 mysql批量插入数据
- 2023 International Conference on Information and Communication Engineering (JCICE 2023)
- Understanding and use of C# on set() and get() methods
- shell函数
- The difference between span tag and p
- 数据库 单表查询
- Analysis of Mvi Architecture
- redis persistence
- Flutter real machine running and simulator running
猜你喜欢
随机推荐
【过一下10】sklearn使用记录
2022杭电多校第一场01
【Untitled】
day7-列表作业(1)
Flex layout frog game clearance strategy
phone call function
第四讲 反向传播随笔
Dashboard Display | DataEase Look at China: Data Presents China's Capital Market
学习总结week2_5
分布式和集群
Matplotlib(三)—— 实践
Community Sharing|Tencent Overseas Games builds game security operation capabilities based on JumpServer
序列基础练习题
Structured light 3D reconstruction (1) Striped structured light 3D reconstruction
Basic properties of binary tree + oj problem analysis
Lecture 5 Using pytorch to implement linear regression
ESP32 485 Illuminance
RL reinforcement learning summary (1)
Do you use tomatoes to supervise your peers?Add my study room, come on together
Machine Learning (2) - Machine Learning Fundamentals
![[cesium] element highlighting](/img/99/504ca9802db83eb33bc6d91b34fa84.png)








