当前位置:网站首页>6.2 function-parameters
6.2 function-parameters
2022-07-29 05:07:00 【学习make me happy】
链接
parameters 是什么
- 变量名
- 数据从调用环境传递到被调用函数
- 这个过程叫传参
Two ways to pass into a function:
- pass by value
- pass by reference
Pass by value: fundamental type
the parameter is a copy of the original variable
- num1和x在内存的不同位置
- 调用foo时候,只是将20从内存复制到变量x的位置
- return的时候,再把结果拷贝到num2在内存的位置
如上是不会修改主函数中的值,如果想修改主函数中的值,可以参考如下。
Pass by value: pointor
传递的值是p的值,也就是num1de地址。
Pass by value: Structure
修改mat中的rows cols值不会影响外面的。
但是使用mat的pData修改pData指向的内容,会修改外面。
?question
如果结构体很大,怎么传参。
边栏推荐
- How to monitor micro web services
- Solution | get the relevant information about the current employees' highest salary in each department |
- 开区网站打开自动播放音乐的添加跟修改教程
- 传奇如何一台服务器配置多个版本微端更新
- 【文件下载】Easyexcel快速上手
- AUTOSAR从入门到精通100讲(七十八)-AUTOSAR-DEM模块
- Stack and queue and priority queue (large heap and small heap) simulation implementation and explanation of imitation function
- Five correlation analysis, one of the most important skills of data analysts
- How does excel filter out the content you want? Excel table filtering content tutorial
- Exception - ...MaxUploadSizeExceededException: Maximum upload size exceeded; nested exception is ...
猜你喜欢
MySQL sorts the queried result set according to the specified sequence
AUTOSAR从入门到精通100讲(七十八)-AUTOSAR-DEM模块
Pivot table of odoo development tutorial
ARFoundation入门教程10-平面检测和放置
ARFoundation从零开始8-Geospatial API(地理空间)开发
Deep learning brush a bunch of tricks of SOTA
How to make the characters in the photos laugh? HMS core video editing service one click smile function makes people smile more naturally
[2022 freshmen learning] key points of the third week
Stack and queue and priority queue (large heap and small heap) simulation implementation and explanation of imitation function
What if excel is stuck and not saved? The solution of Excel not saved but stuck
随机推荐
ARFoundation从零开始3-创建ARFoundation项目
AUTOSAR from introduction to proficiency 100 lectures (78) -autosar-dem module
What servers are needed to build mobile app
Double type nullpointexception in Flink flow calculation
虚拟偶像的歌声原来是这样生成的!
Original code, inverse code, complement code
Youxuan database failed to start and reported network error
What if the computer cannot open excel? The solution of Excel not opening
ThreadPoolExecutor simple to use
关于servlet中实现网站的页面跳转
The song of the virtual idol was originally generated in this way!
Google gtest事件机制
Open source Huizhi creates the future | the openeuler sub forum of 2022 open atom global open source summit was successfully held
JS daily question (10)
基于注解的三层项目的改造及添加包扫描的方式
How to solve the problem of configuring the progress every time Office2010 is opened?
AttributeError: ‘module‘ object has no attribute ‘create_ connection‘
Learn the first program of database
2021-10-11
Stack and queue and priority queue (large heap and small heap) simulation implementation and explanation of imitation function