当前位置:网站首页>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
边栏推荐
- Multi-threaded query results, add List collection
- Detailed Explanation of Redis Sentinel Mode Configuration File
- LAB Semaphore Implementation Details
- Community Sharing|Tencent Overseas Games builds game security operation capabilities based on JumpServer
- [Study Notes Dish Dog Learning C] Classic Written Exam Questions of Dynamic Memory Management
- uva1325
- Difference between for..in and for..of
- 结构光三维重建(一)条纹结构光三维重建
- 【过一下 17】pytorch 改写 keras
- 「PHP8入门指南」PHP简明介绍
猜你喜欢
【过一下7】全连接神经网络视频第一节的笔记
【过一下6】机器视觉视频 【过一下2被挤掉了】
OFDM Lecture 16 5 -Discrete Convolution, ISI and ICI on DMT/OFDM Systems
Develop a highly fault-tolerant distributed system
RL强化学习总结(一)
LeetCode: 1403. Minimum subsequence in non-increasing order [greedy]
RL reinforcement learning summary (1)
DOM及其应用
Difference between for..in and for..of
机器学习(一) —— 机器学习基础
随机推荐
shell函数
Redux
The mall background management system based on Web design and implementation
CAP+BASE
第四讲 反向传播随笔
2022牛客多校第四场C.Easy Counting Problem(EGF+NTT)
【过一下15】学习 lstm的一周
【过一下7】全连接神经网络视频第一节的笔记
【Over 16】Looking back at July
Analysis of Mvi Architecture
vscode+pytorch使用经验记录(个人记录+不定时更新)
Lecture 2 Linear Model Linear Model
有用番茄来监督自己的同道中人吗?加一下我的自习室,一起加油
【过一下12】整整一星期没记录
Flutter real machine running and simulator running
Matplotlib(三)—— 实践
jvm three heap and stack
第二讲 Linear Model 线性模型
Understanding and use of C# on set() and get() methods
序列基础练习题