当前位置:网站首页>函数(易错)
函数(易错)
2022-07-05 04:16:00 【曹乐乐爱学习】
函数传递数组,指针时候,传递的只是起始地址。
例:1维数组求和
发现,求的数组大小,等于2?而不是5?
解释一下2是怎么来的:因为我的是64位机,而sizeof(int)大家都知道,4字节,32位;所以sizeof(p),应该就是64;为什么是64?因为第一句话我就说了:函数传递数组,指针时候,传递的只是一个地址,64位机的地址,不就是64bit嘛。
所以,要把数组(指针)的大小,也要以形参的形式传递到函数里面来。
--------------------------------------------------------------------------------------------------------------------
字符数组,由于末尾有'\0',所以有时候传参时候可以不需要传数组大小
例:删除字符串中的空格
边栏推荐
- Laravel8 export excel file
- About the prompt loading after appscan is opened: guilogic, it keeps loading and gets stuck. My personal solution. (it may be the first solution available in the whole network at present)
- Interview related high-frequency algorithm test site 3
- 网络安全-记录web漏洞修复
- Seven join join queries of MySQL
- lds链接的 顺序问题
- IronXL for . NET 2022.6
- open graph协议
- [phantom engine UE] the difference between running and starting, and the analysis of common problems
- Convert Boolean to integer value PHP - Convert Boolean to integer value PHP
猜你喜欢
Moco is not suitable for target detection? MsrA proposes object level comparative learning target detection pre training method SOCO! Performance SOTA! (NeurIPS 2021)...
The development of mobile IM based on TCP still needs to keep the heartbeat alive
【thingsboard】替换首页logo的方法
Rust区块琏开发——签名加密与私钥公钥
Threejs Internet of things, 3D visualization of factory
Threejs Internet of things, 3D visualization of farms (I)
kubernetes集群之调度系统
如何实现实时音视频聊天功能
[phantom engine UE] only six steps are needed to realize the deployment of ue5 pixel stream and avoid detours! (the principles of 4.26 and 4.27 are similar)
在线SQL转Excel(xls/xlsx)工具
随机推荐
Threejs realizes the drawing of the earth, geographical location annotation, longitude and latitude conversion of world coordinates threejs coordinates
provide/inject
Fuel consumption calculator
MySQL: view with subquery in the from clause limit
Threejs Internet of things, 3D visualization of farm (III) model display, track controller setting, model moving along the route, model adding frame, custom style display label, click the model to obt
After the deployment of web resources, the navigator cannot obtain the solution of mediadevices instance (navigator.mediadevices is undefined)
[thingsboard] how to replace the homepage logo
【虚幻引擎UE】打包报错出现!FindPin错误的解决办法
在线文本行固定长度填充工具
Ctfshow 2022 Spring Festival welcome (detailed commentary)
Judge whether the stack order is reasonable according to the stack order
ClickPaaS低代码平台
Moco is not suitable for target detection? MsrA proposes object level comparative learning target detection pre training method SOCO! Performance SOTA! (NeurIPS 2021)...
Laravel8 export excel file
Open graph protocol
How to remove installed elpa package
网络安全-记录web漏洞修复
[uniapp] system hot update implementation ideas
WGS84 coordinate system, web Mercator, gcj02 coordinate system, bd09 coordinate system - brief introduction to common coordinate systems
【虚幻引擎UE】实现背景模糊下近景旋转操作物体的方法及踩坑记录