当前位置:网站首页>02.01-----参数的引用的作用“ & ”
02.01-----参数的引用的作用“ & ”
2022-08-05 05:13:00 【长路漫漫 大佬为伴】
参数的引用的作用“ & ”
对参数的修改需要带回来的,就要使用引用符号 “&”
无参数的引用“ & ”
#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
使用参数的引用“ & ”
#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
边栏推荐
- OFDM 十六讲 5 -Discrete Convolution, ISI and ICI on DMT/OFDM Systems
- 【过一下7】全连接神经网络视频第一节的笔记
- 【cesium】Load and locate 3D Tileset
- C#关于set()和get()方法的理解及使用
- Flutter学习-开篇
- MySQL Foundation (1) - Basic Cognition and Operation
- 2022牛客多校第四场C.Easy Counting Problem(EGF+NTT)
- 使用二维码解决固定资产管理的难题
- MySQL中控制导出文件后变为了\N有什么解决方案吗?
- Judgment statement _switch and case
猜你喜欢
随机推荐
redis复制机制
【软考 系统架构设计师】软件架构设计③ 特定领域软件架构(DSSA)
【学习笔记之菜Dog学C】动态内存管理之经典笔试题
Geek卸载工具
coppercam入门手册[6]
LeetCode: 1403. Minimum subsequence in non-increasing order [greedy]
jvm 三 之堆与栈
redis 持久化
Cryptography Series: PEM and PKCS7, PKCS8, PKCS12
RDD和DataFrame和Dataset
A blog clears the Redis technology stack
Flex layout frog game clearance strategy
u-boot in u-boot, dm-pre-reloc
【cesium】加载并定位 3D Tileset
Mvi架构浅析
[cesium] 3D Tileset model is loaded and associated with the model tree
Wise Force Deleter强制删除工具
Excel Paint
Flutter Learning 4 - Basic UI Components
【cesium】元素高亮显示




![[cesium] element highlighting](/img/99/504ca9802db83eb33bc6d91b34fa84.png)




