当前位置:网站首页>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
边栏推荐
猜你喜欢

【过一下12】整整一星期没记录

Lecture 2 Linear Model Linear Model

Develop a highly fault-tolerant distributed system

【过一下3】卷积&图像噪音&边缘&纹理

开发一套高容错分布式系统

2022杭电多校第一场01

OFDM Lecture 16 5 -Discrete Convolution, ISI and ICI on DMT/OFDM Systems

Structured Light 3D Reconstruction (2) Line Structured Light 3D Reconstruction

RL reinforcement learning summary (1)

『递归』递归概念与典型实例
随机推荐
【过一下9】卷积
【过一下 17】pytorch 改写 keras
"Recursion" recursion concept and typical examples
2022牛客多校第四场C.Easy Counting Problem(EGF+NTT)
human weakness
NodeJs接收上传文件并自定义保存路径
Mesos学习
「PHP8入门指南」PHP简明介绍
HQL语句执行过程
学习总结week3_4类与对象
位运算符与逻辑运算符的区别
【Reading】Long-term update
【过一下3】卷积&图像噪音&边缘&纹理
ES6 生成器
uva1325
ESP32 485 Illuminance
A blog clears the Redis technology stack
【Untitled】
Database experiment five backup and recovery
序列基础练习题