当前位置:网站首页>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
边栏推荐
- Opencv中,imag=cv2.cvtColor(imag,cv2.COLOR_BGR2GRAY) 报错:error:!_src.empty() in function ‘cv::cvtColor‘
- Matplotlib(二)—— 子图
- 【练一下1】糖尿病遗传风险检测挑战赛 【讯飞开放平台】
- LAB Semaphore Implementation Details
- 软件设计 实验四 桥接模式实验
- 2022 Hangzhou Electric Multi-School 1st Session 01
- [Software Exam System Architect] Software Architecture Design ③ Domain-Specific Software Architecture (DSSA)
- redis复制机制
- ES6 生成器
- Analysis of Mvi Architecture
猜你喜欢

Matplotlib(二)—— 子图

RL强化学习总结(一)

Flutter real machine running and simulator running

NodeJs接收上传文件并自定义保存路径

SQL(二) —— join窗口函数视图

Structured light 3D reconstruction (1) Striped structured light 3D reconstruction

A blog clears the Redis technology stack

The underlying mechanism of the class

机器学习(一) —— 机器学习基础

Convert the paper official seal in the form of a photo into an electronic official seal (no need to download ps)
随机推荐
Develop a highly fault-tolerant distributed system
Lecture 5 Using pytorch to implement linear regression
range函数作用
【记一下1】2022年6月29日 哥和弟 双重痛苦
学习总结week2_2
Convert the paper official seal in the form of a photo into an electronic official seal (no need to download ps)
Opencv中,imag=cv2.cvtColor(imag,cv2.COLOR_BGR2GRAY) 报错:error:!_src.empty() in function ‘cv::cvtColor‘
The mall background management system based on Web design and implementation
server disk array
【过一下16】回顾一下七月
Basic properties of binary tree + oj problem analysis
Pycharm中使用pip安装第三方库安装失败:“Non-zero exit code (2)“的解决方法
BFC(Block Formatting Context)
电话溥功能
Difference between for..in and for..of
What field type of MySQL database table has the largest storage length?
【过一下9】卷积
有用番茄来监督自己的同道中人吗?加一下我的自习室,一起加油
Understanding and use of C# on set() and get() methods
2023 International Conference on Information and Communication Engineering (JCICE 2023)